(coreutils.info)Numeric tests


Next: Connectives for test Prev: String tests Up: test invocation
Enter node , (file) or (file)node

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


automatically generated by info2www version 1.2.2.9