title: How to compare two floating-point values in shell script
body: <p>I had to do a division in shell script and the best way was:</p>
  
  <pre><code>result1=`echo "scale=3; ($var1 / $total) * 100"| bc -l`
  result2=`echo "scale=3; ($var2 / $total) * 100"| bc -l`
  </code></pre>
  
  <p>but I want to compare the values of <code>$result1</code> and <code>$result2</code></p>
  
  <p>Using <code>if test $result1 -lt $result2</code> or <code>if [ $result1 -gt $result2 ]</code> didn't work :(</p>
  
  <p>Any idea how to do that?</p>