to print the selection menu, follow the Select one button to install the different Web Services.
Sample menu:
[Email protected] scripts]# shmenu.sh
1.[install Lamp]
2.[install LNMP]
3.[exit]
pls input the num you want:
Requirements:
1 1 startinstalling lamp. hint "then execute /server/scripts/lamp.sh after exiting the script, the job is formal Lamp one-click installation script;
2 2 startinstalling lnmp. hint " output "Lnmpis Installed "
3, when input 3 , exit the current menu and script;
4, when the input any other characters, give the hint "Input error" after the exit script;
5, to the execution of the script to determine the relevant conditions, such as: whether the script file exists, whether it can be executed and so on, as far as possible to use the knowledge points previously explained.
#!/bin/bashpath=/server/scripts[ ! -d "$path" ] && mkdir -p $ Path#memucat <<end 1. [Install lamp] 2. [Install lnmp] 3. [exit] pls input the num you want:endread numexpr $ num + 1 &>/dev/null[ $? -ne 0 ] &&{ echo "The num you input must be {1|2|3}" exit 1}case $num in 1) echo "Start installing lamp" sleep 3[ -x "$ path/lamp.sh " ]| | { echo "$path/lamp.sh does not exist or can not be exec. " exit 1} $path/lamp.sh #脚本文件 exit $?;; 2) echo "Start installing lnmp" &NBSP;&NBSP;&NBSP;&Nbsp; sleep 3 [ -x "$path/ lamp.sh " ]| | { echo "$path/lnmp.sh does not Exist or can not be exec. " exit 1} $path/lnmp.sh #脚本文件 exit $?;; 3) echo bye. exit 3;; *) echo "the num you input must be {1|2|3}" echo "Input error" exit 4esac
shell-Menu Automation software deployment