coreutils: Numeric tests
1
1 16.3.5 Numeric tests
1 --------------------
1
1 Numeric relational operators. The arguments must be entirely numeric
1 (possibly negative), or the special expression ‘-l STRING’, which
1 evaluates to the length of STRING.
1
1 ‘ARG1 -eq ARG2’
1 ‘ARG1 -ne ARG2’
1 ‘ARG1 -lt ARG2’
1 ‘ARG1 -le ARG2’
1 ‘ARG1 -gt ARG2’
1 ‘ARG1 -ge ARG2’
1 These arithmetic binary operators return true if ARG1 is equal,
1 not-equal, less-than, less-than-or-equal, greater-than, or
1 greater-than-or-equal than ARG2, respectively.
1
1 For example:
1
1 test -1 -gt -2 && echo yes
1 ⇒ yes
1 test -l abc -gt 1 && echo yes
1 ⇒ yes
1 test 0x100 -eq 1
1 error→ test: integer expression expected before -eq
1