一不小心把新写的code全删了,幸好修改的东西不多花了一个小时又改回来了。
所以:
rm -rf 还是不要用了
能用git管理的code绝对不能偷懒
这也说明非常有必要将rm指令改为删除到回收站。但是发现网上的大多数方法是自己给rm起别名来实现,写了一大堆shell,太不优雅了(笑)。
实际上,只要安装一个很小很强大的工具就足够了:https://github.com/andreafrancia/trash-cli
安装:
sudo apt-get install trash-cli
trash-cli提供的指令非常简洁:
最后一个问题是:是否有必要将rm改别名为trash-put呢?trash-put trashes files and directories. trash-empty empty the trashcan(s). trash-list list trashed file. trash-restore restore a trashed file. trash-rm remove individual files from trash can.
我的观点与作者一致,没必要:这只会带来误会和一坨没必要的参数(-r -f -R)。
所以就按照作者的建议在.profile里加了一条提示,然后source之:
alias rm='echo "rm is disabled by harryz, use trash-put instead."; false'
P.S. 顺便发现了source ~/.profile能够修复在SecureCRT里color theme无效的问题