MPE/iX Shell and Utilities Reference Manual, Vol 2
test(1) MPE/iX Shell and Utilities test(1)
expr1 –a expr2
logical AND; true if both expr1 and expr2 are true
expr1 –o expr2
logical OR; true if either expr1 or expr2 is true
! expr logical negation; true if expr is false
( expr ) binding; true if expr is true
The precedence of the operators, in descending order, is:
• unary operators
• comparison operators
• logical AND
• logical OR
The second form of the test command
[ expression ]
is synonymous with the first.
EXAMPLES
This command reports on whether the first positional parameter is a directory or a file:
if[-f$1]
then
echo $1 is a file
elif[-d$1]
then
echo $1 is a directory
else
echo $1 neither file nor directory
fi
This example illustrates the use of test, and is not intended to be an efficient method.
DIAGNOSTICS
Possible exit status values are:
0 The expression was true.
1 The expression was false or missing.
2 The expression was badly formed.
1-600 Commands and Utilities