Re: rm -rf .* alternatives
Colin Watson writes:
> Just in case other people try this, 'rm -rf .*' is VERY DANGEROUS.
> '.*' expands to include '.' and '..', and if you happen to have
> privileges to write to the parent directory then you'll end up
> removing all directories *next* to your current directory as well!
That was true on System III, but:
toncho//tmp mkdir foo
toncho//tmp cd foo
toncho//tmp/foo touch a .b
toncho//tmp/foo mkdir c .e bar
toncho//tmp/foo cd bar
toncho//tmp/foo/bar touch .d
toncho//tmp/foo/bar rm -rf .*
rm: cannot remove `.' or `..'
rm: cannot remove `.' or `..'
toncho//tmp/foo/bar cd ..
toncho//tmp/foo ls -a
. .. .b .e a bar c
toncho//tmp/foo cd ..
toncho//tmp rm -rf foo
toncho//tmp ls foo
ls: foo: No such file or directory
However, I always use something like .??* for the same reason I always type
'sync;sync' before rebooting.
--
John Hasler
john@dhh.gt.org
Dancing Horse Hill
Elmwood, Wisconsin
Reply to: