bash does not float, 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<key?1:0}') # or var=$(awk 'BEGIN{print "'$result'"<"'$key1'"?1:0}') # or if [ "$var" -eq 1 ];then echo "do something" else echo "result more than key" fi
there are other shells that can do float, such as zsh or ksh, you can also try to use them.
ghostdog74 Mar 11 '10 at 12:21 2010-03-11 12:21
source share