taming "rm *" (was Re: Worm/Passwords)

Rahul Dhesi dhesi at bsu-cs.UUCP
Sat Nov 19 02:12:39 AEST 1988


A universal fix for the "rm *" problem (if you can call it a problem)
is to make the "rm" command a built-in, so it asks "Are you sure?" if
the user attempts "rm *".

Experienced users could alias "rm" to "rm -n", which never prompts with
the "Are you sure?" message.

Note that making "rm" a built-in does not mean that the code for it
must be linked with the shell.  The shell only needs to recognize "rm"
and handle wildcard expansion in a special way, and then invoke /bin/rm
to do the actual unlinking.  This naturally means that a user could
create a new alias for /bin/rm, or invoke /bin/rm by full pathname, to
get the effect of the original program.  This is actually a feature
rather than a bug.

Better still, let's avoid changing what established commands do.  All
shell authors, please include a special keyword "del" that prompts
with the "Are you sure?" question if it sees "*" as a parameter, and
then exec /bin/rm.  Tell novice programmers to use "del".
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi



More information about the Comp.unix.wizards mailing list