Next: true, Previous: source, Up: Command-line and menu entry commands [Contents][Index]
Evaluate expression and return zero exit status if result is true, non zero status otherwise.
expression is one of:
==
string2the strings are equal
!=
string2the strings are not equal
<
string2string1 is lexicographically less than string2
<=
string2string1 is lexicographically less or equal than string2
>
string2string1 is lexicographically greater than string2
>=
string2string1 is lexicographically greater or equal than string2
-eq
integer2integer1 is equal to integer2
-ge
integer2integer1 is greater than or equal to integer2
-gt
integer2integer1 is greater than integer2
-le
integer2integer1 is less than or equal to integer2
-lt
integer2integer1 is less than integer2
-ne
integer2integer1 is not equal to integer2
-pgt
prefixinteger2integer1 is greater than integer2 after stripping off common non-numeric prefix.
-plt
prefixinteger2integer1 is less than integer2 after stripping off common non-numeric prefix.
-nt
file2file1 is newer than file2 (modification time). Optionally numeric bias may be directly appended to -nt
in which case it is added to the first file modification time.
-ot
file2file1 is older than file2 (modification time). Optionally numeric bias may be directly appended to -ot
in which case it is added to the first file modification time.
-d
filefile exists and is a directory
-e
filefile exists
-f
filefile exists and is not a directory
-s
filefile exists and has a size greater than zero
-n
stringthe length of string is nonzero
string is equivalent to -n string
-z
stringthe length of string is zero
(
expression )
expression is true
!
expressionexpression is false
-a
expression2both expression1 and expression2 are true
both expression1 and expression2 are true. This syntax is not POSIX-compliant and is not recommended.
-o
expression2either expression1 or expression2 is true
Next: true, Previous: source, Up: Command-line and menu entry commands [Contents][Index]