Today the weather is cloudy, a little bored, so boring to play like ...
#!/bin/bash#date:2017-6-20#version:1.0#author:xcn ([email protected]) 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 [ $num 1 -eq 1 ] && { echo "Installing apache" sleep 3 echo "install is Apacheed " menu1} [ $num 1 -eq 2 ] && { echo "Installing mysql" sleep 3 echo "Install is mysqled " menu1}[ $num 1 -eq 3 ] && { echo "installing php" sleep 3 echo "install is php" menu1}[ $num 1 -eq 4 ] && { echo "return to previous menu " menu}}####################[ menu2 ]################ ########################[ $a -eq 2 ] && { clear menu2 [ $num 2 -eq 1 ] && { echo "Installing nginx" sleep 3 echo "Install is nginx" menu2} [ $num 2 -eq 2 ] && { echo "Installing mysql" sleep 3 echo "install is mysqled" menu2}[ $num 2 -eq 3 ] & & { echo "installing php" sleep 3 echo "Install is php " menu2}[ $num 2 -eq 4 ] && { echo "Return to previous menu" menu}}[ $a -eq 3 ] & & { echo "Baybay" exit} Miracle appeared:[[email protected] ~]# 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: ******** 2installing mysqlinstall is mysqled 1. [Apche] 2. [Mysql] 3. [Php] 4. [back] pls input the lamp menu num you want: ******** *****************************
This article is from the "Little Rookie" blog, please be sure to keep this source http://baishuchao.blog.51cto.com/12918589/1941361
Shell level Two Menu