String comparison: Result
String1 = string2 string1 equals string2: True, otherwise false
String1! = String2 string1 equals to string2: false, otherwise true
-When n string is not equal to NULL: True, otherwise false
-Z string when string is null: true; otherwise, false
Arithmetic comparison result
Expression1-EQ expression2 expressions are equal: True, otherwise false
Expression1-ne expression2 expressions are not equal: True, otherwise false
When expression1-GT expression2 expression expression1 is greater than expression2: True, otherwise false
When the expression1-ge expression2 expression expression1 is greater than or equal to expression2: True, otherwise false
When expression1-lt expression2 expression expression1 is less than expression2: True, otherwise false
When the expression1-Le expression2 expression expression1 is less than or equal to expression2: True, otherwise false
! If expression is true, it is false.
File condition Result
-D When file is a directory: true; otherwise, false
-E file: true if file exists; otherwise, false. Note: historical reasons-e option is not portable. Therefore, use-F instead.
-F file exists: true; otherwise, false
-G file: true if the file is set by "Set-group-ID"; otherwise, false
-R file is readable: true; otherwise, false
-S file size is greater than 0: True, otherwise false
-U file is set to true by "Set-user-ID"; otherwise, false
-W file writable: true; otherwise, false
-X file is an executable file: true; otherwise, false