-1
這裏是shell腳本代碼,當我在CentOS的6.6使用,它將有兩個錯誤消息....Centos的6.6 shell腳本-syntax錯誤附近意外的標記
./script12.bash: line 11: syntax error near unexpected token `$1'
./script12.bash: line 11: `case $1 in'
你能幫我找到錯誤?
#! /bin/bash
num=0
until [ "$num" -eq 30 ]
do
echo -n "Please input a number here : "
read num
if [ "$num" -gt 30 ] ; then
echo "$num" is too big , try again.
echo
elif [ "$num" -eq 30 ] ; then
echo BINGO !! you got it.
else
echo "$num" is too small , try again.
echo
fi
done
嘗試運行第11行的腳本改爲'echo「BINGO !!看起來,'!!'被評估爲歷史擴展,儘管該功能應該在非交互式shell中關閉。你可能會以某種方式打開它,但是提出的編輯應該有助於確定是否是這種情況。 – chepner
錯誤消息引用'case $ 1 in',這在您發佈的代碼中不存在。錯誤來自其他地方。另外,你的shebang行中不應該有空格(它應該是'#!/ bin/bash')。 –
@Jordan:那個空間是好的(只要是正常的ascii空間就行了) – Mat