String Operators

The string operators are:

Note: There is another operator, -n, which we will not use.  It is often mis-documented and causes confusion.

Integer Operators

The integer operators are binary operators.  They are preceded and followed by integer literals, variables or expressions that result in an integer.   An error is generated if there is not an integer value before and after, so do not use with unset variables.

Remember: valid integer values must be on both sides of the operator.  Examples:

File Operators

File operators are followed by a single argument.   Multiple arguments will generate an error.  If there is no argument or a variable after the operator that is empty, no error will be generated and the command will return true (I know, that just doesn't seem to make sense.).  If you are looking at a soft link, the results are reported for the source or destination of the link (what the link is pointing at).

Examples: