shell 判断大小

test.sh

#!/bin/bash
read -p ""  a
read -p ""  b

if [ $a -eq $b ];then
    echo "="
elif [ $a -gt $b ];then
    echo ">"
elif [ $a -lt $b ];then
    echo "<"
fi

输出

bogon:Desktop macname$ ./test.sh 
2
6
<
bogon:Desktop macname$ ./test.sh 
6
2
>
bogon:Desktop macname$ ./test.sh 
6
6
=

参考:

https://www.cnblogs.com/jw15327/p/6114886.html

原文地址:https://www.cnblogs.com/sea-stream/p/11396225.html