#!/bin/bash # -eq 是等于 test "$1" -eq "$2" if [ $? -eq 0 ] then echo "$1 == $2" else echo "$1 != $2" fi # -gt 是大于 test "$1" -gt "$2" if [ $? -eq 0 ] then echo "$1 > $2" else echo "$1 !> $2" fi # -lt 是小于 test "$1" -lt "$2" if [ $? -eq 0 ] then echo "$1 < $2" else echo "$1 !< $2" fi # -ge 是大于等于 test "$1" -ge "$2" if [ $? -eq 0 ] then echo "$1 >= $2" else echo "$1 !>= $2" fi # -le 是小于等于 test "$1" -le "$2" if [ $? -eq 0 ] then echo "$1 <= $2" else echo "$1 !<= $2" fi # -ne 是不等于 test "$1" -ne "$2" if [ $? -eq 0 ] then echo "$1 != $2" else echo "$1 == $2" fi