integer comparison operators

The test operators that compare whole numbers: -eq equal, -ne not equal, -lt less than, -le at most, -gt greater than and -ge at least.

In more detail

Inside [ ] and [[ ]] the symbols < and > compare text alphabetically, not numbers, which is why these letter operators exist. Inside (( )) you can write the usual < and > for numbers.

Example

if [[ $count -gt 0 ]]; then echo positive; fi

Related terms

Taught in

References