my task is to verify if $VAL NUMBER could be float or integer , is less then number 1
I did
val=0.999
[[ $val -lt 1 ]] && echo less then 1
-bash: [[: 0.999: syntax error: invalid arithmetic operator (error token is ".999")
what is the right way to compare any $val number ( float or integer ) and test it if the value is less than 1?
solutions can be also with Perl/Python line linear that will be part of my bash script
Use
bc. Write the expression you want to evaluate tobc's standard input, and it will output the result. In this case, a boolean expression will produce 0 if false, 1 if true.