?????嵥 9.??????????????????????
????filenameNow=$(awk /$filename/'{print $1}' ~/trash/.log)
????filenamebefore=$(awk /$filename/'{print $2}' ~/trash/.log)
????echo "you are about to restore $filenameNow??original name is $filenamebefore"
????echo "original path is $originalPath"
?????嵥 10.???????????λ?ò??????????
echo "Are you sure to do that?[Y/N]"
read reply
if [ $reply = "y" ] || [ $reply = "Y" ]
then
$(mv -b "$HOME/trash/$filename" "$originalPath")
$(sed -i /$filename/'d' "$HOME/trash/.log")
else
echo "no files restored"
fi
??????????????? trash ??
??????? delete ??????????????????????????????????????????????????trash ???????????????????????????????????????????? trash ???μ?????????á???????????????????????д??? 7 ??????????????????????????????????????????? Linux ????? crontab??
????Crontab ?? Linux ??????????г???????????????????????????????????????????Crontab ?????????????????е??????????????е????????????иù??????? Linux ?????????????????????????
????1??????е???????????????????е???????籸????????????????
????2????????е????????????????????????????????? 10 ???????????????????????????Щ?????????????????????á?
?????????д crontab ???????????? cleanTrashCan.???嵥 10 ??????y???????????????
?????ж??????е?????????????????? 7 ???????????????????????
??????????????.log ????????????????????????????????Ч?????????Ч???
?????嵥 11.??????????????? 7 ???????????.log ????????
arrayA=($(find ~/trash/* -mtime +7 | awk '{print $1}'))
for file in ${arrayA[@]}
do
$(rm -rf "${file}")
filename="${file##*/}"
echo $filename
$(sed -i /$filename/'d' "$HOME/trash/.log")
done
?????????д??????? chmod ????????????????????? crontab –e ???????????μ?????????
????10 18 * * * /bin/ cleanTrashCan
?????????????????????????? 6 ?? 10 ????? cleanTrashCan ???
???????????????????trash ???С??????Ч???????????????????????????????????????
??????????
??????????? delete ?????logTrashDir ?????restoreTrash ????? cleanTrashCan ???/bin ???£?????? chmod +x delete restoreTrash logTrashDir cleanTrashCan ????????????????????????
???????? delete ?????????????????????/usr ???μ? useless ???????????????????λ????????????·????·??????????????磺delete useless??delete ./useless ???? delete /usr/useless????й?????? 1 ?????

????? 1.delete ?????й???

??????????useless ???????????????????????$HOME/trash ?£???????????????? 2.?????

????? 2.???????

?????????.log ?????? 3.?????

????? 3.log ???????

????????????????????????????????ü???????????? restoreTrash ??????????????????·???£?restoreTrash ~/trash/useless_20140923_06_28_57??????????????? 4 ???:

????? 4.restoreTrash ?????????

??????/usr ??????????? useless ????????????????

????? 5.useless ????????

???????
??????????? Windows ?л???????????? Linux ????????????????Ч??????????????????????????????????????????/bin ???£??????? crontab ??????? Linux ????????