的腳本提供yourname意外的EOF錯誤
#!/bin/bash
echo "what is your name?"
read name
if test "$name" = "Daryl"
then
echo "Hey, how are you?"
else
echo "sorry, im looking for Daryl"
fi
的腳本yourGrade
#!/bin/bash
./yourname
if[ 0 -eq "$?" ]
then
exit 0
else
echo "what is your grade?"
read grade
if [ "$grade" -gt 90 ]
then
echo "Awesome! You got an A"
elif [ "$grade -le 90 ] && [ "$grade" -gt 80 ]
then
echo "Good! You got a B"
elif [ "$grade" -lt 80 ];
then
echo "You need to work harder!"
fi
我試圖把它使得腳本yourGrade它需要你的姓名檢查,這是達里爾,如果不停止程序。然後如果是要求等級,則讀取等級值並根據等級返回相應的消息。
我每次運行它,我得到...
[email protected]:~# . yourGrade
What is your name?
>Daryl
Hey how are you!
-bash : yourGrade: line 17: syntax error near unexpected token 'elif'
-bash : yourGrade: line 17:' elif [ "$grade" -le 90 ] && [ "$grade" -gt 80 ]'
任何幫助,將不勝感激!
感謝您的幫助,我是一個新手,所以這真的有幫助! – bobblehead808