1 2 3 4 5 6 | if [ ! -f ~/trash/.log ] then touch ~/trash/.log chmod 700~/trash/.log fi echo $1 $2 $3 $4>> ~/trash/.log |
1 | originalPath=$(awk /$filename/'{print $4}' "$HOME/trash/.log") |
1 2 3 4 | 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" |
1 2 3 4 5 6 7 8 9 | 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 |
1 2 3 4 5 6 7 8 | 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 |
1 | 10 18 * * * /bin/ cleanTrashCan |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |