test - condition evaluation utility
test expression [ expression ]
The test utility evaluates the expression and, if it evaluates to true, returns a zero (true) exit status; otherwise it returns 1 (false). If no expression is given, test also returns 1 (false).
All operators and flags are separate arguments to the test utility.
The following primaries are used to construct expression:
True if file exists and is a block special file.
True if file exists and is a character special file.
True if file exists and is a directory.
True if file exists (regardless of type).
True if file exists and is a regular file.
True if file exists and its set-group-ID flag is set.
True if file exists and is a symbolic link. This operator is for COMPATABILITY purposes, do not rely on its existence. Use -L instead.
True if file exists and its sticky bit is set.
True if the length of string is nonzero.
True if file is a named pipe (FIFO).
True if file exists and is readable by the effective user/group.
True if file exists and has a size greater than zero.
True if the file whose file descriptor number is file_descriptor is open and is associated with a terminal.
Same as above with an implicit file descriptor number of "1" (e.g.: -t 1).
True if file exists and its set-user-ID flag is set.
True if file exists and is writable by the effective user/group. True indicates only that the write flag is on. The file is not writable on a read-only file system even if this test indicates true.
True if file exists and is executable by the effective user/group. True indicates only that the execute flag is on. If file is a directory, true indicates that file can be searched.
True if the length of string is zero.
True if file exists and is a binary file.
True if file exists and is a symbolic link.
True if file exists and its owner matches the effective user ID of this process.
True if file exists and is readable by the real user/group.
True if file exists and is a socket.
True if file exists and is a text file.
True if file exists and is writable by the real user/group. True indicates only that the write flag is on. The file is not writable on a read-only file system even if this test indicates true.
True if file exists and is executable by the real user/group. True indicates only that the execute flag is on. If file is a directory, true indicates that file can be searched.
True if file1 exists and is newer than file2.
True if file1 exists and is older than file2.
True if string is not the null string.
True if the strings s1 and s2 are identical.
True if the strings s1 and s2 are not identical.
True if string s1 comes before s2 based on the ASCII value of their characters.
True if string s1 comes after s2 based on the ASCII value of their characters.
True if s1 is not the null string.
True if the integers n1 and n2 are algebraically equal.
True if the integers n1 and n2 are not algebraically equal.
True if the integer n1 is algebraically greater than the integer n2.
True if the integer n1 is algebraically greater than or equal to the integer n2.
True if the integer n1 is algebraically less than the integer n2.
True if the integer n1 is algebraically less than or equal to the integer n2.
These primaries can be combined with the following operators:
True if expression is false.
True if both expression1 and expression2 are true.
True if either expression1 or expression2 are true.
True if expression is true (uses parentheses for grouping).
Note that the -a operator has higher precedence than the -o operator. Notice also that all the operators and flags are separate arguments to test.
The test utility exits with one of the following values:
Expression evaluated to true.
Expression evaluated to false or expression was missing.
An error occurred.
Command line arguments like parentheses and arithmetic operators (e.g.: '(', ')', '!', '>', '<', etc.) may be meaningful to the command-line interpreter (shell) and therefore may need to be escaped from any special shell interpretation.
sh, find
To install PerlPowerTools, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PerlPowerTools
CPAN shell
perl -MCPAN -e shell install PerlPowerTools
For more information on module installation, please visit the detailed CPAN module installation guide.