May 2000
Beginner
761 pages
18h 20m
English
test [expr] test [--help, --version]
test evaluates an expression and returns an exit status indicating that the expression is either true (zero) or false (not zero). Now a built-in version is used primarily by Bourne, Bash, and Korn shells for string, numeric, and file testing. The C/TC shells have most of the tests built-in. (See the Bash built-in commands.)
1 test 5 gt 6 2 echo $? (Bourne and Korn Shells) (Output is 1, meaning the result of the test is not true.) |
Explanation
The test command performs an integer test to see if 5 is greater than 6.
The $? variable contains the exit status of the last command. If a nonzero status is reported, the test results are not true; ...
Read now
Unlock full access