Protection from "rm *"

Alvin E. Sylvain asylvain at felix.UUCP
Thu Oct 4 06:15:02 AEST 1990


In article <853 at agcsun.UUCP> jackm at agcsun.UUCP () writes:
>I happened on an interesting way to protect against those accidental "rm *"'s
>that take years off your life.
[...]
>This most likely isn't new, but I've never seen it. Anyway, just create
>a file called "#" and turn off its write permission. Then if you type
>"rm *", rm will ask if you want to override protection on "#" - BEFORE
[...]
>	alias mkdir '/bin/mkdir \!^; touch \!^/#; chmod 0 \!^/#'
[...]
>So - anyone seen this before? See any drawbacks?
[...]

No, I haven't seen it before (cute!) ... one very minor drawback
is that any files beginning with an even lower ascii value, such
as space, ", !, or any control character, will be removed before
you get to your # file.  These files were probably created in error
by a program, but may still be valuable.

If this proves to be a problem (unlikely), you could solve it by
using control-A instead of #.  I don't see how a file could possibly
begin with a NUL on a non-corrupted file system, so that one's out.
Call it '?rm-check' or such, (?==^A) in case your ls command won't
display control characters.  (Ultrix displays them as ?)
--
=======================Standard Disclaimers Apply=======================
"We're sorry, but the reality you have dialed is no   |            Alvin
longer in service.  Please check the value of pi,     |   "the Chipmunk"
or pray to your local diety for assistance."          |          Sylvain



More information about the Comp.unix.misc mailing list