![]()
[root@localhost wyb]# cat zonghe.sh
#!/bin/bash
#zonghe
usage(){
case $choice in
1)
read -p "please input the old file and new file : " old_file new_file
cp -r $old_file $new_file
if [ $? -eq 0 ];then
echo "success!" >&2
fi
sleep 2
;;
2)
read -p "please input the file and newname : " file newname
mv $file $newname
if [ $? -eq 0 ] ;then
echo "success!" >&2
fi
sleep 2
;;
3)
read -p "please input the file or dir you wanna del : " filename
rm -rf $filename
if [ $? -eq 0 ];then
echo "success!" >&2
fi
sleep 2
;;
4)
read -p "please input the file you wanna find : " file
find / -name $file
if [ $? -eq 0 ];then
echo "success!" >&2
fi
sleep 2
;;
5)
exit 0
;;
*)
;;
esac
}
while :
do
cat<<EOF
*************************************
* MENU *
* 1.copy 2.rename *
* 3.remove 4.find *
* 5.exit *
*************************************
EOF
read -p "please enter your choice : " choice
usage
done