read answer1
if [ "$answer1" = 'y' -o "$answer1" = 'Y' ];then
address=$(sed -n "$answer""p" $mvlog | awk -F: '{print $1}')
filename=$(sed -n "$answer""p" $mvlog | awk -F: '{print $2}')
filerand=$(sed -n "$answer""p" $mvlog | awk -F: '{print $3}')
fullname=$address/$filename
if [ -e "$fullname" ];then
echo "The file exist!"
sleep 0.5
else
old="$trash/$filename:$filerand"
new="$address/$filename"
mv "$old" "$new"
#deline=$(cat $mvlog|sed "$answer""d" | sort -o $mvlog)
deline=$(cat $mvlog|sed "$answer""d" >> $tmp)
mv $tmp $mvlog
echo "restore success!"
sleep 0.5
fi
fi
fi
}
function help()
{
cat << 'EOF'
Usage: rm [OPTION]... FILE...
Remove (unlink) the FILE(s).
-f, --force ignore nonexistent files, never prompt
-i, --interactive prompt before any removal
--no-preserve-root do not treat `/' specially (the default)
--preserve-root fail to operate recursively on `/'
-r, -R, --recursive remove directories and their contents recursively
--help display this help and exit
By default, rm does not remove directories. Use the --recursive (-r or -R)
option to remove each listed directory, too, along with all of its contents.
To remove a file whose name starts with a `-', for example `-foo',
use one of these commands:
rm -- -foo
rm ./-foo
Note that if you use rm to remove a file, it is usually possible to recover
the contents of that file. If you want more assurance that the contents are
truly unrecoverable, consider using shred.
Report bugs to <bug-coreutils@gnu.org>.
EOF
}
#脚本开始
#检测回收站已用存储空间,如果已经达到最大值,则删除日志文件中位于前面的一半的文件
mem=$(du -s $trash|awk '{print $1}')
if [ "$mem" -gt $maxmemory ];then
deal
fi
if [ "$#" -eq 0 ];then
echo_msg
fi
if [ "$#" -eq 1 ];then
case "$from1" in
-i)
echo_msg
-f)
echo_msg
-r | -R)
echo_msg
-ir|-ri|-iR|-Ri|-if|-fi|-rf|-fr|-Rf|-fR)
echo_msg
-l)
rml
-c)
rmc
--help)
help
-*)
echo_msg2 $from1
*)
rm1
esac
fi
if [ "$#" -ge 2 ];then
until [ "$2" = "" ]
do
from2=$2
case "$from1" in










