On 4/6/07, James G. Sack (jim) <[EMAIL PROTECTED]> wrote:

Another practical recommendation:

 Never include _any_ paths in a rm -rf command

That is, if you want to get rid of a tree at /path/to/somedir
 Always cd to the direct parent .. cd /path/to
 Run the command with the bare dir name .. rm -rf somedir

The idea: if you _never have any slash_ in the command then you can't
accidentally get a disaster such as could happen with inadvertent
spaces, such as

  rm -rf / path/to/somedir  .. would operate on '/'  OOPS


Yes but . . . better be sure that the "cd" succeeded.  It might fail
because you misspelled the directory name.  Then you will be invoking
"rm -rf" in the directory where you started, not the one you wanted.
Too easy to get in the habit of not watching the result of commands
that you _know_ will do what you want.

Especially important if you want to put a command of this type into a
shell script.

   carl
--
   carl lowenstein         marine physical lab     u.c. san diego
                                                [EMAIL PROTECTED]


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to