[ -a FILE ] |
FILE exists. |
[ -b FILE ] |
FILE exists and is a block-special file. |
[ -c FILE ] |
FILE exists and is a character-special file. |
[ -d FILE ] |
FILE exists and is a directory. |
[ -e FILE ] |
FILE exists. |
[ -f FILE ] |
FILE exists and is a regular file. |
[ -g FILE ] |
FILE exists and its SGID bit is set. |
[ -h FILE ] |
FILE exists and is a symbolic link. |
[ -k FILE ] |
FILE exists and its sticky bit is set. |
[ -p FILE ] |
FILE exists and is a named pipe (FIFO). |
[ -r FILE ] |
FILE exists and is readable. |
[ -s FILE ] |
FILE exists and has a size greater than zero. |
[ -t FD ] |
file descriptor FD is open and refers to a terminal. |
[ -u FILE ] |
FILE exists and its SUID (set user ID) bit is set. |
[ -w FILE ] |
FILE exists and is writable. |
[ -x FILE ] |
FILE exists and is executable. |
[ -O FILE ] |
FILE exists and is owned by the effective user ID. |
[ -G FILE ] |
FILE exists and is owned by the effective group ID. |
[ -L FILE ] |
FILE exists and is a symbolic link. |
[ -N FILE ] |
FILE exists and has been modified since it was last read. |
[ -S FILE ] |
FILE exists and is a socket. |
[ FILE1 -nt FILE2 ] |
FILE1 has been changed more recently than FILE2, or if FILE1 exists and FILE2 does not. |
[ FILE1 -ot FILE2 ] |
FILE1 is older than FILE2, or is FILE2 exists and FILE1 does not. |
[ FILE1 -ef FILE2 ] |
FILE1 and FILE2 refer to the same device and inode numbers. |
[ -o OPTIONNAME ] |
shell option “OPTIONNAME” is enabled. |
[[ STRING =~ ^regex$ ]] |
STRING matches regex |
[ -z STRING ] |
the length of “STRING” is zero. |
[ -n STRING ] or [ STRING ] |
the length of “STRING” is non-zero. |
[ STRING1 == STRING2 ] |
the strings are equal. “=” may be used instead of “==” for strict POSIX compliance. |
[ STRING1 != STRING2 ] |
the strings are not equal. |
[ STRING1 < STRING2 ] |
“STRING1” sorts before “STRING2” lexicographically in the current locale. |
[ STRING1 > STRING2 ] |
“STRING1” sorts after “STRING2” lexicographically in the current locale. |
[ ARG1 OP ARG2 ] |
“OP” is one of -eq, -ne, -lt, -le, -gt or -ge. * |