Conditional Expressions
A conditional expression is used with the [[compound command to test attributes of files and to compare strings. Field splitting and file name generation are not performed on the words between [[ and ]]. Each expression can be constructed from one or more of the following unary or binary expressions:
string | True, if string is not null. |
-a file | Same as -e below. This is obsolete. |
-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. |
-e file | True, if file exists. |
-f file | True, if file exists and is an ordinary file. |
-g file | True, if file exists and it has its setgid bit set. |
-k file | True, if file exists and ... |
Get Korn Shell: Unix and Linux Programming Manual, Third Edition, The now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.