O'Reilly logo

Korn Shell: Unix and Linux Programming Manual, Third Edition, The by Anatole Olczak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required