今天天气阴,有点儿无聊,就做了这么无趣的玩样儿。。。。。。
#!/bin/bash #Date:2017-6-20 #Version:1.0 #Author:xcn(baishuchao@yeah.net) menu (){ cat <<END 1.[install lamp] 2.[install lnmp] 3.[exit] pls input the num you want: END read -t 15 a } menu1 (){ cat <<END 1.[APCHE] 2.[MYSQL] 3.[PHP] 4.[BACK] Pls input the lamp menu num you want: ************************************* END read num1 } menu2 (){ cat <<END 1.[NGINX] 2.[MYSQL] 3.[PHP] 4.[BACK] Pls input the lnmp menu num you want: ************************************** END read num2 } #######################[ menu1 ]############################ menu [ $a -eq 1 ] && { clear menu1 [ $num1 -eq 1 ] && { echo "installing apache" sleep 3 echo "install is apacheed" menu1 } [ $num1 -eq 2 ] && { echo "installing mysql" sleep 3 echo "install is mysqled" menu1 } [ $num1 -eq 3 ] && { echo "installing php" sleep 3 echo "install is php" menu1 } [ $num1 -eq 4 ] && { echo "return to previous menu" menu } } ####################[ menu2 ]######################################## [ $a -eq 2 ] && { clear menu2 [ $num2 -eq 1 ] && { echo "installing nginx" sleep 3 echo "install is nginx" menu2 } [ $num2 -eq 2 ] && { echo "installing mysql" sleep 3 echo "install is mysqled" menu2 } [ $num2 -eq 3 ] && { echo "installing php" sleep 3 echo "install is php" menu2 } [ $num2 -eq 4 ] && { echo "return to previous menu" menu } } [ $a -eq 3 ] && { echo "baybay" exit } 奇迹出现: [root@XCN ~]# sh menu.sh 1.[install lamp] 2.[install lnmp] 3.[exit] pls input the num you want: 1 1.[APCHE] 2.[MYSQL] 3.[PHP] 4.[BACK] Pls input the lamp menu num you want: ************************************* 2 installing mysql install is mysqled 1.[APCHE] 2.[MYSQL] 3.[PHP] 4.[BACK] Pls input the lamp menu num you want: *************************************
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。