Floating point numeric comparisions in bash

Hi,

I am trying to compare 2 floating point numbers 0.8 and 0.15 using bash and get the largest of the two. Can anyone advise.

The technique I mention in this thread should work in bash.

#!/bin/bash
# expr prints "1" on success, "0" on failure

echo "Enter two values, space seperated"
read val1 val2

result=`expr $val1 \> $val2`
if [ "$result" -eq "1" ]; then
  echo "$val1 is larger than $val2"
  exit 0
fi
result=`expr $val2 \> $val1`
if [ "$result" -eq "1" ]; then
  echo "$val2 is larger than $val1"
  exit 0
fi

echo "the values are equal"
exit 0

And then....

$ ./compareit.sh
Enter two values, space seperated
0.8 0.15
0.8 is larger than 0.15

Cheers
ZB