The [[...]] command is used to evaluate conditional expressions with file attributes, strings, and integers. The basic format is:
a file
| true if file exists
|
b file
| true if file exists and is a block special file
|
c file
| true if file exists and is a character special file
|
d file
| true if file exists and is a directory
|
f file
| true if file exists is a regular file
|
g file
| true if file exists and its setgid bit is set
|
G file
| true if file exists and its group id matches the current effective group id
|
k file
| true if file exists and its sticky bit is set
|
L file
| true if file exists and is a symbolic link
|
O file
| true if file exists and is owned by the effective user id
|
p file
| true if file exists and is a fifo special file or a pipe
|
r file
| true if file exists and is readable
|
s file
| true if file exists and its size is greater than zero
|
S file
| true if file exists and is a socket
|
t n
| true if file descriptor n is open and associated with a terminal device
|
u file
| true if file exists and its set user-id bit is set
|
w file
| true if file exists and is writable
|
x file
| true if file exists and is executable. If file is a directory, then true indicates that the directory is readable.
|
file1 ef file2
| true if file1 and file2 exist and refer to the same file
|
file1 nt file2
| true if file1 exists and is newer than file2
file1 ot file2
| true if file1 exists and is older than file2
| |