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

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

16.3.4 String tests
-------------------

These options test string characteristics.  You may need to quote STRING
arguments for the shell.  For example:

     test -n "$V"

   The quotes here prevent the wrong arguments from being passed to
‘test’ if ‘$V’ is empty or contains special characters.

‘-z STRING’
     True if the length of STRING is zero.

‘-n STRING’
‘STRING’
     True if the length of STRING is nonzero.

‘STRING1 = STRING2’
     True if the strings are equal.

‘STRING1 == STRING2’
     True if the strings are equal (synonym for =).  Note this form is
     not as portable to other shells and systems.

‘STRING1 != STRING2’
     True if the strings are not equal.

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