#!/bin/bash
#auth chentp0601
#date 20151123
Function menu ()
{
Clear
Cat <<eof
#this is Base menu
1.[install Lamp]
2.[install LNMP]
3.[exit]
Eof
Read-p "Please input 1-3:" List
Case $list in
"1")
While True
Do
Menu_lamp
Done
;;
"2")
While True
Do
Menu_lnmp
Done
;;
"3")
Echo-e "exiting ... \ n";
Sleep 1
Exit 0
;;
*)
Continue
;;
Esac
}
function Menu_lamp ()
{
Clear
Cat <<eof
#this is lamp menue
1.[install Apache]
2.[install MySQL]
3.[install PHP]
4.[back]
Eof
Read-p "Please input 1-3:" List1
Case $list 1 in
"1")
ECHO-E "Installing apache\n"
Sleep 2
Continue
;;
"2")
ECHO-E "Installing mysql\n"
Sleep 2
;;
"3")
ECHO-E "Installing Php\n"
Sleep 2
;;
"4")
Break
;;
*)
Continue
;;
Esac
}
function Menu_lnmp ()
{
Clear
Cat <<eof
#this is lnmp menu
1.[install Nginx]
2.[install MySQL]
3.[install PHP]
4.[back]
Eof
Read-p "Please input 1-4:" List2
Case $list 2 in
"1")
ECHO-E "Installing nginx\n"
Sleep 2
Continue
;;
"2")
ECHO-E "Installing mysql\n"
Sleep 2
;;
"3")
ECHO-E "Installing Php\n"
Sleep 2
;;
"4")
Break
;;
*)
Continue
;;
Esac
}
While True
Do
Menu
Done
This article is from the "Advance Bar Rookie" blog, please make sure to keep this source http://chentp.blog.51cto.com/10638759/1716086
Shell Script Implementation command line multilevel menu (no specific function)