.po 1i
.TH TEST 1 Bell
.V 08/15/84 17:07:37
.\" @[$]test.1	1.6	08/15/84 17:07:37 - Zilog Inc.
.ad
.fi
.SH NAME
test \- evaluate files, strings, and numbers
.SH SYNOPSIS
.B test
\fIexpr\fR
.SH DESCRIPTION
.B Test
evaluates the expression
.IR expr ,
and if its value is true then returns zero exit status; otherwise, a
nonzero exit status is returned.
.B Test
returns a nonzero exit if there are no arguments.
.PP
The following primitives are used to construct
.IR expr :
.TP 9n
.BR \-r " file"
true if the file exists and is readable.
.TP 
.BR \-w " file"
true if the file exists and is writable.
.TP 
.BR \-x " file"
true if the file exists and is executable.
.TP 
.BR \-f " file"
true if the file exists and is not a directory.
.TP 
.BR \-d " file"
true if the file exists and is a directory.
.TP 
.BR \-c " file"
true if the file exists and is a character special file.
.TP 
.BR \-b " file"
true if the file exists and is a block special file.
.TP 
.BR \-u " file"
true if the file exists and its set-user-ID bit is set.
.TP 
.BR \-g " file"
true if the file exists and its set-group-ID bit is set.
.TP 
.BR \-k " file"
true if the file exists and its sticky bit is set.
.TP 
.BR \-s " file"
true if the file exists and has a size greater than zero.
.TP 
.BR \-t " [ fildes ]"
true if the open file whose file descriptor number is
.I fildes
(1 by default)
is associated with a terminal device.
.TP 
.BR \-z " s1"
true if the length of string
.I s1
is zero.
.TP 
.BR \-n " s1"
true if the length of the string
.I s1
is nonzero.
.TP 
.RB s1 " = " s2
true
if the strings
.I s1
and
.I s2
are equal.
.TP 
.RB s1 " != " s2
true
if the strings
.I s1
and
.I s2
are not equal.
.TP 
s1
true if
.I s1
is not the null string.
.TP 
.RB n1 " \-eq " n2
true if the integers
.I n1
and
.I n2
are algebraically equal.
Any of the comparisons
.BR \-ne ,
.BR \-gt ,
.BR \-ge ,
.BR \-lt ,
or
.BR \-le
can be used in place of
.BR \-eq .
.PP
These primaries can be combined with the
following operators:
.TP 
.B  !
unary negation operator
.TP 
.B  \-a
binary
.I and
operator
.TP 
.B  \-o
binary
.I or
operator
.TP 
.BR "( " "expr" " )"
parentheses for grouping.
.TP
.B \-a
has higher precedence than
.B \-o.
.DT
.PP
All the operators and flags are separate
arguments to
.BR test .
Parentheses are meaningful
to the shell and must be escaped.
.SH SEE ALSO
csh(1), expr(1), find(1), sh(1).
.br
\fIThe C Shell\fR in the ZEUS Utilities Manual


