Scripsit ille David Garamond <davegaramond / icqmail.com>:
> Jeremy Henty wrote:
> >> ... it's amazing to see that over the years the unix CLI hasn't got
> >>a good replacement for "rm" that does trash-can-thingy
> > 
> > http://www.m-arriaga.net/software/libtrash/
> > 
> > "This is the homepage of libtrash, a shared library which, when
> > preloaded, implements a trash can under GNU/Linux."
> 
> cool. thanks for the link. i do remember vaguely that there are a couple 
> of libraries that do trash can/recycle bin.
> 
> however, i believe the safest approach is to replace (=remove, 
> =deprecate, =discourage/forbid usage) "/bin/rm" altogether, and educate 
> users to use something else like, say, "/bin/del", or "/bin/erase" 
> (which is the safer alternative). let's keep /bin/rm as it is: the 
> dangerous, unforgiving, destructive file deletion command. sysadmins or 
> users might also want to remove it from the system.

This breaks most Makefiles. Some of them even don't work if the variable
RM is set accordingly.

The LD_PRELOAD approach has one disadvantage: if some external tool removes
temporary files, they are also recycled. Even if you exclude /tmp, it's
not always what you want. If a Makefile or shell script uses rm, it's
normally OK. That's why I would call such a script 'recycle'. Personally
I call it with that name.

Currently in my .bashrc:

  alias rm='echo "Use \"recycle\" instead."; echo >/dev/null'

Aliasing it away is OK since it doesn't break existing scripts.

| bash$ recycle --help
| Usage:
|   recycle [-rm] filename...  moves files or directories out of the way
|   recycle -ls directory      lists deleted files in a directory
|   recycle -lsv directory       verbosely
|   recycle -lsa directory     lists all deleted files
|   recycle -lsav directory      verbosely
|   recycle -un filename...    undeletes a file or directory
|   recycle -9 filename...     deletes files
|   recycle -9r filename...    deletes directories
|   recycle -cl directory      removes a directory from the trash bin
|   recycle -cla directory     empties the trash bin
| 
| In most cases, recycle can be used as a replacement of rm.

[...]

-- 
Du fingst mit Einem heimlich an,
Bald kommen ihrer mehre dran,
Und wenn dich erst ein Dutzend hat,
So hat dich auch die ganze Stadt.