if [ `expr $a \> $b` -eq 0 ];then
   echo $b is bigger
else
    echo $a is bigger
fi
[root@tengxunyunslave wallog]# cat  /opt/monitor_load1.sh
#!/bin/bash
RECORD_TIME=`date '+%Y-%m-%d'`
#获取现在的负载,如果大于30,记录active的SQL
LOAD1=`/usr/bin/w|grep load|awk -F [':'] '{print $5}'  |awk  -F [',']  '{print $1}' `

if [ `expr $LOAD1 \> 0.1` -eq 1 ];
then
    echo $LOAD1
    echo "========================== $RECORD_TIME  ===================================" >> /home/wallog/load_monitor.log
        /usr/bin/psql  -Upostgres -p15432  -h127.0.0.1  -d  postgres  -c "select * from pg_stat_activity where state='active';" >> /home/wallog/load_monitor.log
fi

(9条消息) Linux shell中对小数进行比较的方法_带大金链子的攻城狮的博客-_shell 小数比较

用一个例子来演示会更加清晰