2016-12-06 113 views
-1

我想將開關盒撥入開關盒。但我得到錯誤。將開關盒撥入開關盒

### User prompts 
read -p "Would you like to download all source codes and build them? \"(Y|N)\" " inPut 
# Get user prompt not case sensitive 
case $inPut in 
# First case 
"y"|"Y") echo 'Starting.....' 
donwload_source_code 

    read -p "Would you like to start all servers? \"(Y|N)\" " inPutserver 
    case $inPutserver in 
    "y"|"Y") echo 'Starting.....' 
    open_new_terminals_automatically $DIR "rails -s" 

;; 

# Second case 
"n"|"N") echo 'Stopping script execution...' 
exit 
;; 

esac 

我得到的錯誤,當我運行該腳本:

run.sh: line 589: syntax error: unexpected end of file 

我怎樣才能解決這個問題?

回答

1

你還沒有終止內部case構造應該如下。

read -p "Would you like to start all servers? \"(Y|N)\" " inPutserver 
case $inPutserver in 
"y"|"Y") echo 'Starting.....' 
open_new_terminals_automatically $DIR "rails -s" 
;; 
esac  # <------ Notice the termination here. 

利用http://www.shellcheck.net並從那裏修復腳本的瑣碎問題。