I'm trying to perform simple math, to check if a variable is greater or equal to "1.5"
but I'm getting [: 2.41: integer expression expected
Code:
reSum=$(expr "scale=1;555/230" | bc)
if [ $reSum -ge "1.5" ]; then
...
fi
How can I do floating-point comparisons in shell script?
info expr< <= = == != >= >' Compare the arguments and return 1 if the relation is true, 0 otherwise.==' is a synonym for='.expr' first tries to convert both arguments to integers and do a numeric comparison; if either conversion fails, it does a lexicographic comparison using the character collating sequence specified by the `LC_COLLATE' locale.