[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Typos protection for rm

From: Eric Blake
Subject: Re: Typos protection for rm
Date: Sat, 09 Feb 2008 09:11:14 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071031 Thunderbird/ Mnenhy/

Hash: SHA1

According to ShprotX on 2/9/2008 8:21 AM:
| I have an idea how to reduce the likelihood of damage from typos in
| using of rm. rm needs one option in which specified files/dirs aren't
| deleted until one of them doesn't exist (including deleting of
| directories without "-r" option). In this way an accidental space or
| missing quotes won't result in deleting of wrong files in most cases.

Thanks for the report.  First things first - POSIX specifies the current
behavior of rm without options, so we cannot change the default behavior.
~ So the only way to change things is with an option.  But adding options
from the command line every time involves more typing, so it is less
likely to be done by the user.  Therefore, the only way to make rm safer
is via an alias or wrapper script which adds the desired options on your
behalf.  On the other hand, if systems provide such wrappers, and still
name it by rm, then users get used to the 'extra' protection on their
system, and then fail spectacularly when moving to other systems that
don't provide such wrappers.  Therefore, on this list, we recommend that
you consider giving any such wrapper script a separate name (in this case,
maybe del or delete), to make it explicit to the user that they are not
invoking raw rm.

That said, rm already comes with options -i and -I, which were both
designed to reduce the likelihood of unintentional damage.  Is there
anything wrong with rm's existing set of options that cannot accomplish
what you wanted in the context of an alias?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


reply via email to

[Prev in Thread] Current Thread [Next in Thread]