MPE/iX Shell and Utilities Reference Manual, Vol 2
test(1) MPE/iX Shell and Utilities test(1)
NAME
test — test for condition
SYNOPSIS
test expression
[ expression ]
DESCRIPTION
Note: The MPE/iX implementation of this utility does not function exactly as this man page de-
scribes. For details, see the MPE/iX NOTES section at the end of this man page.
The test command checks for various properties of files, strings and integers. It produces no
output (except error messages) but returns the result of the test as the exit status; see DIAG-
NOSTICS for more information.
The command line is a Boolean expression. The simplest expression is a string which is true if
the string is non-empty (that is, has non-zero length). More complex expressions are com-
posed of operators and operands, each of which is a separate argument (that is, surrounded by
white space). The operators imply the number and type of their operands. The operators tak-
ing a file operand evaluate as false (without error) if the file does not exist.
Operators
test accepts the following operators:
–b file true if the file is a block special file
–c file true if the file is a character special file
–d file true if the file is a directory
–e file true if the file exists
–f file true if the file is an ordinary file
–g file true if the setgid attribute of the file is on
–k file true if the save text attribute of the file is on
–L file true if file is a symbolic link
–n string true if the length of string is greater than zero
–p file true if the file is a
FIFO (named pipe)
–r file true if the file is readable
1-598 Commands and Utilities