Test
operators
-e file
exists
-f file
exists and is not a directory
-s file
is not empty
-d
directory exists
-x file
is executable (for the user running the test)
-r file
is readable (for the user running the test)
-w file
has write permission (for user running the test)
-h / -L
file is a symbolic link
!
"not"
Compound
Comparison
-a
logical 'and' similar to &&
-o
logical 'or' similar to ||
Integer
Comparison
-eq is
equal to
-ne is
not equal to
-gt or
> is greater than
-ge or
>= is greater than or equal to
-lt or
< is less than
-le or
<= is less than or equal to
String
Comparison
=
==
<
>
!= is
not equal to
-z
string is null (that is, has zero length)
-n
string is not null