红联Linux门户
Linux帮助

shell脚本 请高手帮忙看下,错在哪里?无论我输入什么,都不对的!谢谢

发布时间:2008-09-12 16:11:20来源:红联作者:jevens-ly
#!/bin/bash
echo "Guess the secret color"
read COLOR
while [ $COLOR != "purple" ]
do
echo "Incorrect.Guess again. \n"
read $COLOR
done
echo "Correct."
文章评论

共有 2 条评论

  1. jevens-ly 于 2008-09-17 09:30:43发表:

    谢谢啦~~

  2. percy 于 2008-09-13 16:11:33发表:

    将read $COLOR 中的$去掉。

    pjq@localhost ~ $ ./test.sh
    Guess the secret color
    asdf
    Incorrect.Guess again.
    sadf
    Incorrect.Guess again.
    purple
    Correct.