How to compare two decimal numbers in bash/awk?

前端 未结 7 2155
傲寒
傲寒 2020-12-08 15:09

I am trying to compare two decimal values but I am getting errors. I used

if [ \"$(echo $result1 \'>\' $result2 | bc -l)\" -eq 1 ];then

相关标签:
7条回答
  • 2020-12-08 15:59

    Can't bash force type conversion? For example:

    ($result1 + 0) < ($result2 + 0)
    
    0 讨论(0)
提交回复
热议问题