NAME
test - condition command

SYNOPSIS
test expr
[ expr ]

DESCRIPTION
test evaluates the expression expr, and if its value is true then
returns zero exit status; otherwise, a non zero exit status is
returned. test returns a non zero exit if there are no arguments.

The following primitives are used to construct expr.

-b file true if file exists and is a block special device.

-c file true if file exists and is a character special device.

-d file true if file exists and is a directory.

-f file true if file exists and is not a directory.

-g file true if file exists and its set-group-ID bit is set.

-h file true if file exists and is a symbolic link.

-k file true if file exists and its sticky bit is set.

-l s1 length of string s1

-n s1 true if the length of the string s1 is nonzero.

-p file true if file exists and is a named pipe (FIFO).

-r file true if file exists and is readable.

-s file true if file exists and has a size greater than zero.

-t [ fildes ]
true if the open file whose file descriptor number is
fildes (1 by default) is associated with a terminal
device.

-u file true if file exists and its set-user-ID bit is set.

-w file true if file exists and is writable.

-x file true if file exists and is executable.

-z s1 true if the length of string s1 is zero.

s1 = s2 true if the strings s1 and s2 are equal.

s1 != s2 true if the strings s1 and s2 are not equal.

s1 true if s1 is not the null string.

n1 -eq n2
true if the integers n1 and n2 are algebraically equal.

n1 -ne n2
true if n1 is not equal to n2 .

n1 -gt n2
true if n1 is greater than n2 .

n1 -ge n2
true if n1 is greater than or equal to n2 .

n1 -lt n2
true if n1 is less than n2 .

n1 -le n2
true if n1 is less than or equal to n2 .

These primaries may be combined with the following operators:

! unary negation operator

-a binary and operator

-o binary or operator

( expr )
parentheses for grouping.

-a has higher precedence than -o. Notice that all the operators and
flags are separate arguments to test. Notice also that parentheses
are meaningful to the Shell and must be escaped.

SEE ALSO
sh(1), find(1)

WARNING
In the second form of the command, the square brackets must be
delimited by spaces.