Name
test
Synopsis
testcondition[condition] [[condition]]
Evaluate a condition and, if its value is
true, return a zero exit status; otherwise, return a nonzero exit
status. An alternate form of the command uses [ ] rather than the word test. An additional alternate form uses
[[ ]], in which case word
splitting and pathname expansion are not done. (See the [[ ]] entry.)
condition is constructed using the following
expressions. Conditions are true if the description holds
true.
File Conditions
| file
exists. (Deprecated; use |
| file exists and is a block special file. |
| file exists and is a character special file. |
| file exists and is a directory. |
| file
exists. (Same as |
| file exists and is a regular file. |
| file exists, and its set-group-id bit is set. |
| file exists, and its group is the effective group ID. |
| file
exists and is a symbolic link. (Same as
|
| file exists, and its sticky bit is set. |
| file
exists and is a symbolic link. (Same as
|
| file exists and was modified after it was last read. |
| file exists, and its owner is the effective user ID. |
| file exists and is a named pipe (FIFO). |
| file exists and is readable. |
| file exists and has a size greater than zero. |
| file exists and is a socket. |
| The open file descriptor n is associated with a terminal device; default n is 1. |
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access