scripts

Per Liden per at fukt.hk-r.se
Mon Jun 12 03:42:51 PDT 2000


On Mon, 12 Jun 2000, Claudio Nieder wrote:

> Hi,
> 
> >     you might want to do ``/bin/rm -rf /tmp/* /tmp/.*''.  (X and certain
> > other programs make dotfiles in /tmp.)
> 
> !!!!!!   D E A D L Y   W R O N G   !!!!!!
> 
> But experiance for yourself if you dare. I did once, though only with 
> a subdirectory of my home dir.
> 
> /tmp/.* matches also ..
> 
> Thus you are /bin/rm -rf /tmp/..
> 
> Which s equivalent to /bin/rm -rf /

WRONG!

. and .. is NOT accepted by rm as the last path component of a file. 
Thus, rm -rf /tmp/.* is safe and will not delete /tmp/.. (ie. /).

----- from man page ------ 
It is an error when the last path component of file is either . or ..  
(so as to avoid unpleasant surprises with 'rm -r .*' or so). 
------ end ------

Try it yourself, typing "rm -rf .." gives you
rm: cannot remove `.' or `..'

/pli

--
Per Liden  <per at fukt.hk-r.se>  <http://www.fukt.hk-r.se/~per>

--
Mail archive: http://www.pcrdallas.com/mail-archives/lfs-discuss
IRC access: server: irc.linuxfromscratch.org port: 6667 channel: #LFS
News Reader access: news.pcrdallas.com
Unsubscribe: email lfs-discuss-request at linuxfromscratch.org and put
"unsubscribe" (without the quotation marks) in the body of the message
(no subject is required)



More information about the lfs-dev mailing list