2016-12-06 115 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并从那里修复脚本的琐碎问题。