> Suggestion: > =========== > If an argument looks like / or /* then prompt the user with a message like this: > > user@localhost> rm -r /* > rm: You are about the remove all entries from the root filesystem. > This will make your system unusable, are you sure? (y/n)
A common misconception is that unix programs expand wildcard arguments. But that is not true. The command shell expands shell file wildcards. The rm command never sees the '/*'. Here is another piece of information to understand the behavior. The shell interpreter is expanding the command line glob characters prior to handing the arguments off to your command. This is a simple form of regular expression matching designed to make file name matching easier. This provides a consistent interface to all programs since the expansion code is common to all programs by being in the interpreting shell instead of in the program itself. Commands in UNIX do not see the '/*' or any of the shell metacharacters. Commands see the expanded out names which the shell found matched file names in current directory. The "*" is the "glob" character because it matches a glob of characters. The shell matches and expands glob characters and hands of the resulting information to the command. You can double check this by using the echo command. This is built into most command shells, for example into bash. Try echo /*. The command would see the result and has no idea that you provided a wild card to match against file names. What you suggest, a double check for certain operations, might possibly be implemented as part of the "completion" subsystem of command shells like zsh and bash. You might check into those programs and see if they have the capability to screen those dangerous commands first since those are the only place the full text of the dangerous command is seen. http://www.zsh.org/ and http://www.caliban.org/bash/index.shtml#completion Bob _______________________________________________ Bug-fileutils mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-fileutils