I am trying hard to compare two floating point numbers within a bash script. I have to variables, e.g.
let num1=3.17648e-22 let num2=1.5
No
please check the below edited code:-
#!/bin/bash export num1=(3.17648*e-22) export num2=1.5 st=$((`echo "$num1 < $num2"| bc`)) if [ $st -eq 1 ] then echo -e "$num1 < $num2" else echo -e "$num1 >= $num2" fi
this works well.