shell脚本,编写1个弹出式菜单的shell程序并实现其简单的菜单功能。

时间:2021-11-29 06:16:59

shell脚本,编写1个弹出式菜单的shell程序并实现其简单的菜单功能。

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