好吧,實際上這是腳本的樣子:Bash中使用「和」 while循環
echo -n "Guess my number: "
read guess
while [ $guess != 5 ]; do
echo Your answer is $guess. This is incorrect. Please try again.
echo -n "What is your guess? "
read guess
done
echo "That's correct! The answer was $guess!"
我想改變的是這一行:
while [ $guess != 5 ]; do
爲了這樣的事情:
while [ $guess != 5 and $guess != 10 ]; do
在Java中,我知道「和」是「& &」,但似乎並沒有工作ħ ERE。我是用正確的方式來使用while循環嗎?
編輯:更新的問題,使其在搜索更加有用..
JFYI代碼不正確:應該有'讀guess',不'$讀guess'。 –
感謝您發現錯字:) – Smitty