.\" Copyright (c) 1991 Regents of the University of California.
.\" This code is derived from software contributed to Berkeley by
.\" the Institute of Electrical and Electronics Engineers, Inc.
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" @(#)test.1 6.6 (Berkeley) 6/8/92
.Nd Condition evaluation utility.
utility evaluates the expression and, if it evaluates
to true, returns a zero (true) exit status; otherwise
If there is no expression, test also
All operators and flags are separate arguments to the
The following primaries are used to construct expression:
exists and is a block special
exists and is a character
exists and is a directory.
exists (regardless of type).
exists and is a regular file.
exists and its set group ID flag
.Ar file exists and is readable.
exists and has a size greater
.It Fl t Ar [file_descriptor]
True if the file whose file descriptor number
(default 1) is open and is
associated with a terminal.
exists and its set user ID flag
indicates only that the write flag is on.
The file is not writable on a read-only file
system even if this test indicates true.
exists and is executable.
indicates only that the execute flag is on.
is a directory, true indicates that
.It Ar \&s\&1 Cm \&= Ar \&s\&2
.It Ar \&s\&1 Cm \&!= Ar \&s\&2
.It Ar \&n\&1 Fl \&eq Ar \&n\&2
.It Ar \&n\&1 Fl \&ne Ar \&n\&2
.It Ar \&n\&1 Fl \> Ar \&n\&2
.It Ar \&n\&1 Fl \&ge Ar \&n\&2
greater than or equal to the integer
.It Ar \&n\&1 Fl \< Ar \&n\&2
.It Ar \&n\&1 Fl \&le Ar \&n\&2
than or equal to the integer
These primaries can be combined with the following operators:
.It Ar expression1 Fl a Ar expression2
.It Ar expression1 Fl o Ar expression2
.It Cm \&( Ns Ar expression Ns Cm \&)
True if expression is true.
operator has higher precedence than the
grammar is inherently ambiguous. In order to assure a degree of consistency,
the cases described in the
section D11.2/4.62.4, standard
are evaluated consistently according to the rules specified in the
standards document. All other cases are subject to the ambiguity in the
utility exits with one of the following values:
expression evaluated to true.
expression evaluated to false or expression was
function is expected to be