Just wondering how can I check if a floating point value is within a certain range using "bc" and the conditional statements in bash. Thanks in advance
For example,I want to find out if 17.2 is within the range from 17.5 to 18.2.
Have recently learned that I can use bc to check in a statement like this:
if [ $(bc <<< "$result > 17.5") -eq 1 ]
Have tried to do this
if [ $(bc <<< "$result > 17.5") && $(bc <<< "$result <= 18.2") -eq 1 ]
But keep a getting syntax error and also unsure if that's the correct expression or syntax.