shell腳本菜單操作案例:
#!/bin/bash while true do # clear cat << EOF ********please enter your choise:(1-6)**** (1) auto_deploy_war (2) start tomcat (3) stop tomcat (4) restart tomcat (5) print tomcat logs (6) Exit EOF read -p "請輸入你的選擇 1|2|3|4|5|6: " input case "$input" in 1) echo "do_auto_deploy......" # do_auto_deploy ;; 2) echo "do_start......" # do_start ;; 3) echo "do_stop......" # do_stop ;; 4) echo "do_restart......" #do_restart ;; 5) echo "print tomcat log......" #do_print_log ;; 6) echo 'Bye!......' sleep 3 break ;; *) echo "error inputs!" echo echo "USAGE: 1|2|3|4|5|6" read -p "請輸入你的選擇 1|2|3|4|5|6: " input esac done