标签:多分支if
#!/bin/bashread -p "Please input your score: " score
if [ $score -le 100 -a $score -ge 90 ];then
echo "A"
elif [ $score -lt 90 -a $score -ge 80 ];then
echo "B"
elif [ $score -lt 80 -a $score -ge 70 ];then
echo "C"
elif [ $score -lt 70 -a $score -ge 60 ];then
echo "D"
elif [ $score -lt 60 ];then
echo "E"
else
echo "Error"
fi
注释:
[ 1 -gt 10 ] 大于
[ 1 -lt 10 ] 小于
[ 1 -eq 10 ] 等于
[ 1 -ne 10 ] 不等于
[ 1 -ge 10 ] 大于等于
[ 1 -le 10 ] 小于等于
标签:多分支if
原文地址:http://blog.51cto.com/13765357/2121428