· NUM1 -eq NUM2 returns true if NUM1 and NUM2 are numerically equal.
· NUM1 -ne NUM2 returns true if NUM1 and NUM2 are not numerically equal.
· NUM1 -gt NUM2 returns true if NUM1 is greater than NUM2.
· NUM1 -ge NUM2 returns true if NUM1 is greater than or equal to NUM2.
· NUM1 -lt NUM2 returns true if NUM1 is less than NUM2.
· NUM1 -le NUM2 returns true if NUM1 is less than or equal to NUM2.
例如
if [[ $age > 21 ]] # bad, > is a string comparison operator
if [ $age > 21 ] # bad, > is a redirection operator
if [[ $age -gt 21 ]] # okay, but fails if $age is not numeric
if (( $age > 21 )) # best, $ on age is optional