原文地址:http://blog.sina.com.cn/s/blog_7921902d01012nla.html
if 条件判断中有多个条件
#!/bin/bash
score=$1
if [ $score = 5 ]||[ $score = 3 ];then
else
fi
-------------------------------------------------------
#!/bin/bash
score=$1
if [ $score -gt 5 ]||[ $score -lt 3 ];then
else
fi
-------------------------------------------------------
#!/bin/bash
score=$1
if [ $score -gt 15 ]||([ $score -lt 8]&&[ $score -ne 5 ]);then
else
fi
-------------------------------------------------------
或:
#!/bin/bash
count="$1"
if [ $count -gt 15 -o $count -lt 5];then
且:
#!/bin/bash
count="$1"
if [ $count -gt 5 -a $count -lt 15];then
fi
-------------------------------------------------------
score=$1
if [[ $score -gt 15 || $score -lt 8&& $score -ne 5 ]];then
echoright
else
echowrong
fi
记住必须加两个中括号
score=$1
if [[ $score -gt 15 || $score -lt 8&& $score -ne 5 ]];then
else
fi
记住必须加两个中括号