test
Evaluates an expression
test expression
[ expression ]
The test utility evaluates an expression and returns a condition code indicating that the expression is either true (0) or false (not 0). You can use brackets ([]) around the expression instead of using the word test (second format).
Arguments
The expression contains one or more criteria (see the following list) that test evaluates. A -a separating two criteria is a Boolean AND operator: Both criteria must be true for test to return a condition code of true. A -o is a Boolean OR operator. When -o separates two criteria, one or the other (or both) of the criteria must be true in order for test to return a condition code of true.
You can negate any criterion by preceding it with an exclamation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access