例子:这两个例子的执行结果是一样的
用[[ ]] 与 &&
#!/bin/bash
#Program:
# Use loop
#History:
# 2013/10/31 first release
while [[ "$yn" != "yes" && "$yn" != "YES" ]]
do
read -p "Please input yes/YES to confirm:" yn
done
echo "Ok! you type write, congratulations!!"
用[ ] 与 -a
#!/bin/bash
#Program:
# Use loop
#History:
# 2013/10/31 first release
while [ "$yn" != "yes" -a "$yn" != "YES" ]
do
read -p "Please input yes/YES to confirm:" yn
done
echo "Ok! you type write, congratulations!!"
|| 和-o 同上