shell脚本菜单操作案例:
#!/bin/bashwhile truedo# clearcat << 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 esacdone