String tests

posted Sep 10, 2010, 7:42 AM by Sachchida Ojha
These options test string characteristics. Strings are not quoted for `test', though you may need to quote them to protect characters with special meaning to the shell, e.g., spaces.
 
`-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 not equal.
Comments