Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 04 Oct 2004 09:08:41 +0100
From:      Mark Murray <markm@FreeBSD.ORG>
To:        Thomas David Rivers <rivers@dignus.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Protection from the dreaded "rm -fr /" 
Message-ID:  <200410040808.i9488gal006311@grimreaper.grondar.org>
In-Reply-To: Your message of "Sat, 02 Oct 2004 21:54:27 EDT." <200410030154.i931sR348272@lakes.dignus.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
Thomas David Rivers writes:
>   If I'm remembering correctly - the historical way to
>  do this is to alias the "rm" command to something that
>  else that checks the arguments and complains appropriately
>  (and then executes /bin/rm.)   Typically with just a shell
>  alias.  That keeps you from accidently doing something. 

Yeah.

$ alias rm="rm -i"

and you get the annoying  "confirm all deletes" behaviour.

>   Just thinking that putting extra "smarts" into a utility
>  isn't the typical "UNIXy" way to do this.  Let each tool
>  do the one thing it does really well.. 'rm' removes; let
>  it remove.

Right. There are SO many special cases here that rm cannot possibly
catch them all:

# cd / ; rm -rf foo/ *
                    ^
                    This space is a typo.

>   I think, in the old "UNIX Review" magazine (what - almost
>  15+ years ago now?)  There was a couple of examples of this.

Many others as well.

"Windows' job is to prevent you from shooting yourself in the foot. With
UNIX, the idea is to make damn sure that there is a hole in your foot with
the greatest possible efficiency." (Paraphrased)

I've typed "rm -rf *" in the wrong place. ONCE. I learned Unix-fu from that
experience. Now, if I type "rm <anything>", I wake up.

M
--
Mark Murray
iumop ap!sdn w,I idlaH



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200410040808.i9488gal006311>