andreafrancia/trash-cli: Command line interface to the freedesktop.org trashcan.
Installation
easy_install trash-cli |
Usage
trash-put trash files and directories. |
FAQ
Can I alias rm to trash-put
在不少网站上看到:建议将 trash-put
命令通过别名的方式代替 rm
alias rm="trush-put" |
但是作者说:
Although rhe interface of trash-put seems to be compatible with rm, it has different semantics which will cause you problems. For example, while rm requires -R for deleting directories trash-put does not.
所以就使用 trush
来删除文件/文件夹到回收站
But sometimes I forget to use trash-put, really can’t I
可以通过建立 rm
的 alias 提醒你不要使用它:
alias rm='echo "This is not the command you are looking for."; false' |
如果你真的想使用 rm
,只需先加一个斜线来绕过 alias:
\rm file-without-hope |
注意:bash alias 仅在交互式 shell 中使用,因此使用 alias 不影响脚本中使用的 rm 命令。
– EOF –