Protection from "rm *"

Raymond Chen raymond at math.berkeley.edu
Mon Oct 1 13:28:55 AEST 1990


I agree with Mr. Davidsen.  Don't alias a system command.  Write
your own "safe rm", call it "can" or "del" or "era", then put the
following in your private bin directory under the name "rm":

	#!/bin/sh
	echo "Don't use rm.  Use del.  If you really want rm, use /bin/rm"

Too often, I've seen people who have a private little rm alias, who
start relying on the -i option, then one day, they do a shell escape
	!rm *
hoping to get the automatic "-i" option, and (oops!) the alias wasn't
active (because they put it in their .login, not their .cshrc), or
the application uses /bin/sh to handle shell escapes, or...
(Heck, it happened to a friend of mine just last week...)



More information about the Comp.unix.misc mailing list