#!/bin/sbin path=/server/scripts [ ! -d "$path"] && mkdir $path -p #menu cat <<END 1.[install lamp] 2.[install lnmp] 3.[exit] pls input the num your want:
END read num expr $num + 1 &>/dev/null [ $? -ne 0 ] &&{ echo "the num you input must be {1|2|3}" exit 1 } [ $num == "1" ] &&{ echo "start installing lamp..." sleep 2; [ -x "$path/lamp.sh" ] ||{ echo "$path/lamp.sh does not exist or can not be exec." exit 1 } source $path/lamp.sh exit $? } [ $num == "2" ] &&{ echo "start installing lnmp..." sleep 2; [ -x "$path/lnmp.sh" ] ||{ echo "$path/lnmp.sh dose not exist or can not be exec." exit 1 } source $path/lnmp.sh exit #? } [ $num -eq "3" ] &&{ echo "bye." exit 3 } [[ ! $num =~ [1-3] ]] &&{ echo "the num you input must be {1|2|3}" echo "input error!" exit 4 }