lyw08china 发表于 2012-09-20 20:50

这个sh脚本怎么理解

## 是否同意协议内容
argeed=
while [ x$argeed = x ]
do
        echo "Do you agree to the above license terms?"
        read reply leftover
        case $reply in
        yes|YES|Yes)
                agreed=1
                break
                ;;
        no|NO|No)
                echo "You can't install this software,install process will exit.";
                exit 1
                ;;
        esac
done
上边的argeed=
while [ x$argeed = x ]
read reply leftover
这三句解释下。谢谢

linux_c_py_php 发表于 2012-09-20 20:55

argeed=
while [ x$argeed = x ]
read reply leftover

初始化agreed为空, 只要agreed为空, 就要求用户从键盘输入yes 或者 no, 直到输入yes才会设置agreed为非空, 此时while循环退出.
页: [1]
查看完整版本: 这个sh脚本怎么理解