参考:http://renylai.blogbus.com/logs/27962818.html

第一种:

#!/bin/bash
#
read -p 'Input a number:' nu
if [ $nu \> 100.00 ]; then
    echo "success..."
else
    echo "failure..."
fi

执行结果对比:

[root@localhost data]# ./test.sh 
Input a number:1
failure...
[root@localhost data]# ./test.sh 
Input a number:1.1
failure...
[root@localhost data]# ./test.sh 
Input a number:10.1
failure...
[root@localhost data]# ./test.sh 
Input a number:11.1
success...
[root@localhost data]# ./test.sh 
Input a number:100.1
success...
[root@localhost data]# ./test.sh 
Input a number:2
success...

第二种和第三种:

#!/bin/bash
#
read -p "input number:" nu
a=`echo "$nu > 100.0"|bc`        #第二种
b=`expr $nu \> 100.0`            #第三种
echo -e "a:$a\tb:$b\tc:$c"

测试结果(正确返回1,错误返回0):

[root@244 sh]# ./test.sh   
input number:1
a:0     b:0
[root@244 sh]# ./test.sh 
input number:1.1
a:0     b:1
[root@244 sh]# ./test.sh 
input number:11.1
a:0     b:1
[root@244 sh]# ./test.sh 
input number:10.1
a:0     b:1
[root@244 sh]# ./test.sh 
input number:100.1
a:1     b:1
[root@244 sh]# ./test.sh 
input number:2
a:0     b:1

个人总结(假设小数A与小数B对比,A和B均大于1):

    第一种:

        1.首先对比小数点左边的数字,只要有一个数字比另外一个数字大,那就是大的数;

        2.如果A小数点左边的数字都小于或者等于B,那么不管A小数点右边的数字是否大于B,A都是小于B的。

    第二种:

        跟整数比较一样。

    第三种(假设小数A与小数B比较,A和B均大于1):

        A与B对比时,去除小数点,从左自右按顺序一一对比,只要A其中一位大于B,那么A就大于B。

如有错误,请指出。