Linux基础-Linux系统回收站

rm / mv :
自己做一个回收站
--思路

cd
mkdir .recycle # 隐藏文件夹 .recycle
mv .txt .recycle/ # 把想要删除的文件移动到.recycle当中
通过定时任务定期清除 .recycle 文件夹中的内容
或者rm -rf ./recycle/

--回收站示例

!/bin/bash

alias rm='mv'
if [-f /tmp/.recycle]
then
echo ".recycle is CUNZAI"
else
touch /tmp/.recycle
fi
sizes=du -m /tmp/.recycle | awk '{print $1}'
if [$sizes -gt 1024]
then
cat /dev/null > /tmp/.recycle
fi

posted on 2019-11-08 19:24  旗木卡卡祥  阅读(738)  评论(0编辑  收藏  举报