Linux Shell脚本中的大于、大于等于、小于等表示方法

大于、小于、大于等于、小于等于、不相等
大于 -gt (greater than) 
小于 -lt (less than) 
大于等于 -ge (greater than or equal) 
小于等于 -le (less than or equal) 
不相等 -ne (not equal)

举例

#!/bin/sh

bakdate=`date +%Y%m%d%H%M%S`
date=`date +"%Y-%m-%d %H:%M:%S"`

count=`netstat -an | wc -l`
if [ $count -ge 4200 ];then
    do something
fi

示例中使用到了大于等于(-ge)

猜你喜欢

转载自blog.csdn.net/weixin_33701564/article/details/87116623
今日推荐