1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
.TP
if {\fIexpression\fP} \fIcommand...\fP
If the evaluated
.I expression
is non-zero, the
.I command
will be executed.
Note that {} rather than () surround the
.IR expression .
.I Expression
may be comprised of numbers, operators, parenthesis, etc.
In addition to the normal +, -, *, and /, are:
.nf
!\fIx\fP yields 0 if \fIx\fP is non-zero, 1 if \fIx\fP is zero.
\fIx\fP && \fIy\fP
!\fIx\fP ġnotYields 1 if \fIx\fP is zero, 0 if non-zero.
\fIx\fP & \fIy\fP ġandYields 1 if both \fIx\fP and \fIy\fP are non-zero, 0 otherwise.
\fIx\fP | \fIy\fP ġor Yields 1 if \fIx\fP or \fIy\fP (or both) is non-zero, 0 otherwise
.fi
There may also be the special tokens
.IR true
and
.IR false
which are 1 and 0 respectively.
There are also
.IR checked ,
.IR matched ,
.IR printed ,
.IR nonword ,
and
.IR filtered
which correspond to the values printed by the
.I stats
command.
An example use might be the following kind of thing in an
computer-generated script:
.nf
!d!expect this line
if {!printed} msg Oops! couldn't find "expect this line"
.fi
|