Common tests in bash for conditional statements

Expressions:

! expression # the expression is false
Strings:
-n string # the length of the string is greater than zero
-z string # the length of the string is zero (empty)
string1 = string2 # string 1 is equal to string2
string1 != string2 # string1 is not equal to string2
Integer:
integer1 -eq integer2 # integer1 is equal to integer2
integer1 -ne integer2 # integer1 is not equal to integer2
integer1 -gt integer2 # integer1 is greater than integer2
integer1 -lt integer2 # integer1 is less than integer2
integer1 -ge integer2 # integer1 is greater than or equal to integer2
integer1 -le integer2 # integer1 is less than or equal to integer2
Files:
-d file # the file exists and is a directory
-f file # the file exists
-r file # the file exists and the read permission is granted
-s file # the file exists and its size is greater than zero
-w file # the file exists and the write permission is granted
-x file # the file exists and execute permission is granted
Examples:
$ test 5 -eq 5
$ echo $?
0
$ test 5 -eq 4
$ echo $?
1