Path: utzoo!attcan!uunet!husc6!cmcl2!rutgers!mit-eddie!genrad!jpn From: jpn@genrad.com (John P. Nelson) Newsgroups: comp.unix.wizards Subject: Re: none. Message-ID: <13557@genrad.UUCP> Date: 22 Nov 88 15:05:42 GMT References: <9784@watdragon.waterloo.edu> <129@orac.UUCP> <4596@ptsfa.PacBell.COM> Sender: news@genrad.UUCP Reply-To: jpn@teddy.UUCP (John P. Nelson) Organization: GenRad, Inc., Concord, Mass. Lines: 24 >>Big mistake. You've just probably destroyed all the user directories on >>the machine, since ".*" matches "..", too. Nice going. > >Maybe on some UNIX systems, but the man page for rm on System V states: > > ".... It is forbidden to remove the file .. merely to avoid > the antisocial consequences of inadvertently doing something like: > > rm -r .* " This is true on Berkeley systems as well. HOWEVER, it is easy to fool rm, because the test only works when ".." is at the BEGINNING of the filename. I was quite surprised the first time I discovered this: I had written a "safe" rm which tucked files away in my "~/.backup" directory, the idea was to clean out the ~/.backup directory when I logged out. when I put the line "rm -rf ~/.backup/* ~/.backup/.*" into my .logout file, I got a nasty surprise! When I logged in again, my entire account had been deleted! ~/.backup/.* had expanded to ~/.backup/.., and rm quite silently recursively removed my home directory! john nelson UUCP: {decvax,mit-eddie}!genrad!teddy!jpn smail: jpn@teddy.genrad.com