後,我跑了一個簡單的腳本,我得到這個消息:的bash語法錯誤:未接受令牌艾利芙
我的代碼line 9: syntax error near unexpected token elif line 9: elif [ $sales -le 20000 ];
:
#!/bin/bash
echo "Please enter the how much sales you have done"
read sales
if [ $sales -le 5000 ];
then
echo "your profit is $[$sales*0.25]"
elif [ $sales -le 10000 ];
echo "your profit is $[$sales*0.1]"
elif [ $sales -le 20000 ];
echo "your profit is $[$sales*0.15]"
elif [ $sales -le 40000 ];
echo "your profit is $[$sales*0.2]"
else
echo "your profit is $[$sales*0.25]"
fi
你缺少了'then's – 123
你你的權利,謝謝:) – Mariel
http://shellcheck.net會抓住這些錯誤,你和那麼,一旦你解決了這些問題,還有其他一些問題。 –