我要創造,我可以根據用戶執行一些功能簡單的女巫情況下提示:錯誤bash腳本開關的情況下
echo Would you like us to perform the option: "(Y|N)"
read inPut
case $inPut in
# echoing a command encapsulated by
# backticks (``) executes the command
"Y") echo 'Starting.....'
donwload_source_code
# depending on the scenario, execute the other option
# or leave as default
"N") echo 'Stopping execution'
exit
esac
但是,當我執行該腳本,我得到錯誤:
Would you like us to perform the option: (Y|N)
n
run.sh: line 27: syntax error near unexpected token `)'
run.sh: line 27: `"N") echo 'Stopping execution''
EMP-SOF-LT099:Genesis Plamen$
陶氏你知道我該如何解決這個問題?
你需要打破case語句用'';;感謝 – 123