about summary refs log tree commit diff
path: root/Doc/Zsh/cond.yo
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/Zsh/cond.yo')
-rw-r--r--Doc/Zsh/cond.yo158
1 files changed, 158 insertions, 0 deletions
diff --git a/Doc/Zsh/cond.yo b/Doc/Zsh/cond.yo
new file mode 100644
index 000000000..0ff49b187
--- /dev/null
+++ b/Doc/Zsh/cond.yo
@@ -0,0 +1,158 @@
+texinode(Conditional Expressions)(Compatibility)(Arithmetic Evaluation)(Top)
+chapter(Conditional Expressions)
+ifzman(\
+sect(Conditional Expressions)
+)\
+cindex(conditional expressions)
+cindex(expressions, conditional)
+A em(conditional expression) is used with the tt([[)
+compound command to test attributes of files and to compare strings.
+Each expression can be constructed from one or more
+of the following unary or binary expressions:
+
+startitem()
+item(tt(-a) var(file))(
+true if var(file) exists.
+)
+item(tt(-b) var(file))(
+true if var(file) exists and is a block special file.
+)
+item(tt(-c) var(file))(
+true if var(file) exists and is a character special file.
+)
+item(tt(-d) var(file))(
+true if var(file) exists and is a directory.
+)
+item(tt(-e) var(file))(
+true if var(file) exists.
+)
+item(tt(-f) var(file))(
+true if var(file) exists and is a regular file.
+)
+item(tt(-g) var(file))(
+true if var(file) exists and has its setgid bit set.
+)
+item(tt(-h) var(file))(
+true if var(file) exists and is a symbolic link.
+)
+item(tt(-k) var(file))(
+true if var(file) exists and has its sticky bit set.
+)
+item(tt(-n) var(string))(
+true if length of var(string) is non-zero.
+)
+item(tt(-o) var(option))(
+true if option named var(option) is on.  var(option)
+may be a single character, in which case it is a single letter option name.
+(See noderef(Specifying Options).)
+)
+item(tt(-p) var(file))(
+true if var(file) exists and is a FIFO special file (named pipe).
+)
+item(tt(-r) var(file))(
+true if var(file) exists and is readable by current process.
+)
+item(tt(-s) var(file))(
+true if var(file) exists and has size greater than zero.
+)
+item(tt(-t) var(fd))(
+true if file descriptor number var(fd)
+is open and associated with a terminal device.
+(note: var(fd) is not optional)
+)
+item(tt(-u) var(file))(
+true if var(file) exists and has its setuid bit set.
+)
+item(tt(-w) var(file))(
+true if var(file) exists and is writable by current process.
+)
+item(tt(-x) var(file))(
+true if var(file) exists and is executable by current process.
+If var(file) exists and is a directory, then the current process
+has permission to search in the directory.
+)
+item(tt(-z) var(string))(
+true if length of var(string) is zero.
+)
+item(tt(-L) var(file))(
+true if var(file) exists and is a symbolic link.
+)
+item(tt(-O) var(file))(
+true if var(file) exists and is owned by the effective user ID of this process.
+)
+item(tt(-G) var(file))(
+true if var(file) exists and its group matches
+the effective group ID of this process.
+)
+item(tt(-S) var(file))(
+true if var(file) exists and is a socket.
+)
+item(tt(-N) var(file))(
+true if var(file) exists and its access time is
+not newer than its modification time.
+)
+item(var(file1) tt(-nt) var(file2))(
+true if var(file1) exists and is newer than var(file2).
+)
+item(var(file1) tt(-ot) var(file2))(
+true if var(file1) exists and is older than var(file2).
+)
+item(var(file1) tt(-ef) var(file2))(
+true if var(file1) and var(file2) exist and refer to the same file.
+)
+xitem(var(string) tt(=) var(pattern))
+item(var(string) tt(==) var(pattern))(
+true if var(string) matches var(pattern).
+The `tt(==)' form is the preferred one.  The `tt(=)' form is for
+backward compatibility and should be considered obsolete.
+)
+item(var(string) tt(!=) var(pattern))(
+true if var(string) does not match var(pattern).
+)
+item(var(string1) tt(<) var(string2))(
+true if var(string1) comes before var(string2)
+based on ASCII value of their characters.
+)
+item(var(string1) tt(>) var(string2))(
+true if var(string1) comes after var(string2)
+based on ASCII value of their characters.
+)
+item(var(exp1) tt(-eq) var(exp2))(
+true if var(exp1) is numerically equal to var(exp2).
+)
+item(var(exp1) tt(-ne) var(exp2))(
+true if var(exp1) is numerically not equal to var(exp2).
+)
+item(var(exp1) tt(-lt) var(exp2))(
+true if var(exp1) is numerically less than var(exp2).
+)
+item(var(exp1) tt(-gt) var(exp2))(
+true if var(exp1) is numerically greater than var(exp2).
+)
+item(var(exp1) tt(-le) var(exp2))(
+true if var(exp1) is numerically less than or equal to var(exp2).
+)
+item(var(exp1) tt(-ge) var(exp2))(
+true if var(exp1) is numerically greater than or equal to var(exp2).
+)
+item(tt(LPAR()) var(exp) tt(RPAR()))(
+true if var(exp) is true.
+)
+item(tt(!) var(exp))(
+true if var(exp) is false.
+)
+item(var(exp1) tt(&&) var(exp2))(
+true if var(exp1) and var(exp2) are both true.
+)
+item(var(exp1) tt(||) var(exp2))(
+true if either var(exp1) or var(exp2) is true.
+)
+enditem()
+
+In each of the above expressions, if
+var(file) is of the form `tt(/dev/fd/)var(n)',
+where var(n) is an integer,
+then the test applied to the open file whose
+descriptor number is var(n),
+even if the underlying system does not support
+the tt(/dev/fd) directory.