shell比较浮点数

   1  t1="3123982193.090000000";
  2 t2="7872348342.003000000";
  3 if [ `expr $t2 \> $t1` -eq 1  ] ; then                                                                            
  4     echo "t2 is big";
  5 fi
  6 echo $t2
~                                                                                                                     
~                                                                                                                     
~              
使用expr,返回1表示a>
a>b, 0表示a<
a<b

 a=6.6 b=5.5;expr $a > $b
posted @ 2019-06-05 22:23  zhaocundang  阅读(586)  评论(0编辑  收藏  举报