shell比较大小数值字符串

#!/bin/shmax=9 min=8if [ $max -gt $min ] then    echo 1else   echo 0fi

数字的比较:-eq 相等(equal)-ne 不等(not equal)-gt 大于(greater than)-lt 小于(less than)-ge 大于等于 (greater than or equal)-le 小于等于 (less than or equal)

字符串的比较:[ $str1 = $str2 ] 等于[ $str1 != $str2 ] 不等于[ -z $str ]  空字符串返回true[ -n $str ] 或者 [ $str ]  非空字符串返回true
(0)

相关推荐