好吧,实际上这是脚本的样子: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