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