A File Test Operator is a unary operator in a Perl expression
, which tests whether one or more condition
s is true about a file.
The following list is stolen from Programming Perl 3rd edition by Larry Wall, Tom Christiansen and Jon Orwant; but I think it's in the realm of fair use.
-r : File is readable by effective UID/GID.
-w : File is writable by effective UID/GID.
-x : File is executable by effective UID/GID.
-o : File is owned by effective UID.
-R : File is readable by real UID/GID.
-W : File is writable by real UID/GID.
-X : File is executable by real UID/GID.
-O : File is owned by real UID.
-e : File exists.
-z : File has zero size.
-s : File has nonzero size (returns size).
-f : File is a plain file.
-d : File is a directory.
-l : File is a symbolic link.
-p : File is a named pipe (FIFO).
-S : File is a socket.
-b : File is a block special file.
-c : File is a character special file.
-t : File is opened to a tty.
-u : File has setuid bit set.
-g : File has setgid bit set.
-k : File has sticky bit set.
-T : File is a text file.
-B : File is a binary file (opposite ot -T).
-M : Age of file (at startup) in days since modification.
-A : Age of file (at startup) in days since last access.
-C : Age of file (at startup) in days since inode change.