打印菜单脚本

#!/bin/sh
#auto to print menu shell
#by zkg 2019-08-06

#define menu function

menu(){
cat << EOF
1.[install lamp]
2.[install lnmp]
3.[exit]
please input the num you want:
EOF
}
menu
read num

[ "$num" = "1" ]&&{
echo "start install lamp"
[ -x /opt/shell/lamp.sh ]||exit 2
sh /opt/shell/lamp.sh
exit 0
}

[ "$num" = "2" ]&&{
echo "start install lnmp"
[ -x /opt/shell/lnmp.sh ]||exit 2
sh /opt/shell/lnmp.sh
exit 0
}

[ "$num" = "3" ]&&{
echo "bye"
exit 0
}
echo "input error"
exit 0

猜你喜欢

转载自blog.51cto.com/1009516/2426905