V4/usr/man/man1/if.1
.th IF I 3/15/72
.sh NAME
if \*- conditional command
.sh SYNOPSIS
.bd if
expr command [ arg ... ]
.sh DESCRIPTION
.it If
evaluates the expression
.it expr,
and if its value is
true,
executes the given
.it command
with the given arguments.
.s3
The following primitives are used to construct
the
.it expr:
.s3
.lp +10 10
\fB\*-r\fR|file true if the file exists and is readable.
.s3
.lp +10 10
\fB\*-w|\fRfile true if the file exists and is writable
.s3
.lp +10 10
s1|\fB=|\fRs2 true
if the strings
.it s1
and
.it s2
are equal.
.s3
.lp +10 10
s1|\fB!=|\fRs2 true
if the strings
.it s1
and
.it s2
are not equal.
.s3
.i0
These primaries may be combined with the
following operators:
.s3
.lp +10 10
\fB!\fR unary negation operator
.s3
.lp +10 10
\fB\*-a\fR binary
.it and
operator
.s3
.lp +10 10
\fB\*-o\fR binary
.it or
operator
.s3
.lp +10 10
\fB(|\fRexpr\fB|)\fR parentheses for grouping.
.s3
.i0
.bd \*-a
has higher precedence than
.bd \*-o.
Notice that all the operators and flags are separate
arguments to
.it if
and hence must be surrounded by spaces.
Notice also that parentheses are meaningful
to the Shell and must be escaped.
.sh "SEE ALSO"
sh(I)
.sh BUGS