首页 > 系统服务 > 详细

替代Linux下的rm命令

时间:2017-11-13 14:49:13      阅读:291      评论:0      收藏:0      [点我收藏+]

方式一:自己编写脚本

编写脚本del.sh

#!/bin/bash

TMP_DIR="/tmp/trash_tmp"

mv $@ $TMP_DIR


chmod +x /home/scripts/del.sh

mkdir -p /tmp/trash_tmp

chmod 777 /tmp/trash_tmp


vim .bashrc

alias rm=‘sh /home/scripts/del.sh

source .bashrc


如果需要使用系统默认的rm,只要用\rm即可

方式二:安装trash

执行easy_install trash-cli安装trash-cli,实现命令行下的回收站。项目见-trash-cli 

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.

alias rm=‘echo "This is not the command you are looking for, Please Use "trash"!!!"; false‘


替代Linux下的rm命令

原文:http://12085228.blog.51cto.com/12075228/1981239

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!