在Linux上实现 Windows 回收站功能的脚本(4)

if [[ $aa != "$1" ]];then #If the first parameter not start with "-".
                du -s "$@" 2>/tmp/$DumpLog |while read line
                do
                        size=`echo $line | awk '$1 >2000000{print $1}'`
                        if [ "$size" > "1900000" ];then
                                #echo "Lager than 2Mb"
                                rm.bak -rf `echo $line|awk '{print $2}'`
                        else
                                TestDir
                        fi
                done

else
                if [[ "$2" != ""  ]]; then
                       until [ "$2" == ""  ]
                       do
                                 #echo "function is running"
                                 du -s $2 2> /tmp/$DumpLog |while read line
                                 do
                                        size=`echo $line | awk '$1 >2000000{print $1}'`
                                        if [ "$size" > "1900000" ];then
                                                #echo "Lager than 2Mb"
                                                rm.bak -rf $2
                                        else
                                                TestDir

fi
                                        shift
                                 done
                                 shift
                        done
                else
                        echo -e "No file detected./nTry 'rm --help' for more information. "
                fi
        fi
else
        echo -e "rm: missing operand /nTry 'rm --help' for more information."
fi 

linux

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwjfsy.html