As it turns out the if statement in bash isn’t as friendly towards floating point variables as it is for integer and string variables.
First of all the -gt and -lt switches don’t work.Even the unary operators >,<, etc. don’t work. The only way is to do a comparison between the floating point variables using bc and using the logical outout as a comparison string.
a=11.5; b=11.3 compare_result=`echo "$a >$b" | bc` if [ $compare_result -gt 0 ]; then echo $a else echo $b fi