改写rm -rf 脚本

#!/bin/bash
fileName=$1
now=`date +%Y%m%d%H%M`
read -p "Are you sure delete the file or directory $1? yes|no: " input
 
if [ $input == "yes" ] || [ $input == "y" ]
then
    mkdir -p /data/$now
    rsync -aR $1/ /data/$now/$1/
    /bin/rm -rf $1
elif [ $input == "no" ] || [ $input == "n" ]
then
    exit 0
else
    echo "Only input yes or no"
    exit
fi

 

posted @ 2020-04-27 11:46  侃豺小哥  阅读(256)  评论(0编辑  收藏  举报