Can you please suggest to me the syntax for doing floating point comparison in a Bash script? I would ideally like to use it as part of an if statement. Here is
if
bash doesn't do floats, use awk
key1=12.3 result=12.5 var=$(awk 'BEGIN{ print "'$key1'"<"'$result'" }') # or var=$(awk -v key=$key1 -v result=$result 'BEGIN{print result
there are other shells that can do floats, like zsh or ksh, you might like to try using them as well