题目:在Shell脚本中,以下哪个case分支结构用于处理用户输入的命令行选项?
A. if [ "$1" = "start" ]; then echo "Starting..."; fi
B. select option in start stop; do echo "$option"; break; done
C. switch("$1") { case "start": echo "Starting..."; break; case "stop": echo "Stopping..."; break; default: echo "Invalid option"; }
D. case "$1" in start) echo "Starting...";; stop) echo "Stopping...";; *) echo "Invalid option";; esac
答案:评论后可见此内容