manpagez: man pages & more
info coreutils
Home | html | info | man

File: coreutils.info,  Node: Numeric tests,  Next: Connectives for test,  Prev: String tests,  Up: test invocation

16.3.5 Numeric tests
--------------------

Numeric relational operators.  The arguments must be entirely numeric
(possibly negative), or the special expression ‘-l STRING’, which
evaluates to the length of STRING.

‘ARG1 -eq ARG2’
‘ARG1 -ne ARG2’
‘ARG1 -lt ARG2’
‘ARG1 -le ARG2’
‘ARG1 -gt ARG2’
‘ARG1 -ge ARG2’
     These arithmetic binary operators return true if ARG1 is equal,
     not-equal, less-than, less-than-or-equal, greater-than, or
     greater-than-or-equal than ARG2, respectively.

   For example:

     test -1 -gt -2 && echo yes
     ⇒ yes
     test -l abc -gt 1 && echo yes
     ⇒ yes
     test 0x100 -eq 1
     error→ test: integer expression expected before -eq

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.