File:  [Research Unix] / researchv10dc / dist / man / v4 / man1 / if.1
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Dan Cross

.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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.