TEST Operators: Files
Operator Tests Whether
-e File exists
-f File is a regular file
-d File is a directory
-h File is a symbolic link
-L File is a symbolic link
-b File is a block device
-c File is a character device
-p File is a pipe
-S File is a socket
-t File is associated with a terminal
-N File modified since it was last read
-O You own the file
-G Group id of file same as yours
-s File is not zero size
-r File has read permission
-w File has write permission
-x File has execute permission
-g sgid flag set
-u suid flag set
-k "sticky bit" set
F1 -nt F2 File F1 is newer than F2 *
F1 -ot F2 File F1 is older than F2 *
F1 -ef F2 Files F1 and F2 are hard links to the same file *
* Binary operator (requires two operands).
! NOT (inverts sense of above tests)
Comments