問題描述:
【解答】
[root@A04-Test-172 scripts]# more menu.sh
#!/bin/bash echo "1.[install lamp]" echo "2.[install lnmp]" echo "3.[exit]" read -p "pls input the num you want: " num case $num in 1) if [ -f "/server/scripts/lamp.sh" ]; then echo "start installing lamp" /server/scripts/lamp.sh echo "lamp is installed" else echo "the script /server/scripts/lamp.sh is not exist!" fi exit ;; 2) if [ -f "/server/scripts/lnmp.sh" ]; then echo "start installing lnmp" /server/scri[ts/lamp.sh echo "lnmp is installed" else echo "the script /server/scripts/lnmp.sh is not exist!" fi exit ;; 3) exit ;; *) echo "Input error" exit ;; esac