[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: scripting question



On Tue, Apr 15, 2003 at 05:45:35PM -0800, Andy wrote:
> On Tuesday 15 April 2003 05:13 pm, Scott Henson wrote:
> > On Tue, 2003-04-15 at 20:40, nate wrote:
> > > rm -rf *
> >
> > Do me a favor.  Try this on your system as root.  Then walk a way
> > and come back an hour later.  Youll need another system to tell us
> > what happened cause yours will be hosed.  This command will
> > generally delete your entire file system.  Trust me, Ive done a form
> > of it before(mv *).
> 
> I have used rm -rf *  as root before and it did not kill my system.
> 
> If you are sitting in /  then yes, I can see how it would take you
> down hard.

There's an amusing defence against that: 'touch /--version'. Then 'rm
-rf *' in / expands to 'rm -rf <stuff> --version <more stuff>', and does
nothing except print its version number and copyright information.

Won't work on all Unices, though, won't defend you against other
damaging actions, and obviously isn't a substitute for care when using
the root account, but I occasionally do it just for insurance anyway. :)

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: