test—evaluates an expression
test evaluates an expression and returns an exit status indicating that the expression is either true (zero) or false (not zero). Used primarily by Bourne and Korn shell for string, numeric, and file testing. The C shell has most of the tests built-in.
Example A.49.
1 test 5 gt 6 2 echo $? ( Bourne and Korn Shells) (Output is 1, meaning the result of the test is not true.) |
EXPLANATION
|
Get UNIX® Shells by Example, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.