1TEST(1)                     General Commands Manual                    TEST(1)
2
3
4

NAME

6       test -  condition command
7

SYNOPSIS

9       test expr
10

DESCRIPTION

12       test  evaluates  the  expression  expr,  and  if its value is true then
13       returns zero  exit  status;  otherwise,  a  non  zero  exit  status  is
14       returned.  test returns a non zero exit if there are no arguments.
15
16       The following primitives are used to construct expr.
17
18       -r file  true if the file exists and is readable.
19
20       -w file  true if the file exists and is writable.
21
22       -f file  true if the file exists and is not a directory.
23
24       -d file  true if the file exists and is a directory.
25
26       -s file  true if the file exists and has a size greater than zero.
27
28       -t [ fildes ]
29                true  if  the open file whose file descriptor number is fildes
30                (1 by default) is associated with a terminal device.
31
32       -z s1    true if the length of string s1 is zero.
33
34       -n s1    true if the length of the string s1 is nonzero.
35
36       s1 = s2  true if the strings s1 and s2 are equal.
37
38       s1 != s2 true if the strings s1 and s2 are not equal.
39
40       s1       true if s1 is not the null string.
41
42       n1 -eq n2
43                true if the integers n1 and n2 are algebraically  equal.   Any
44                of  the  comparisons -ne, -gt, -ge, -lt, or -le may be used in
45                place of -eq.
46
47       These primaries may be combined with the following operators:
48
49       !      unary negation operator
50
51       -a     binary and operator
52
53       -o     binary or operator
54
55       ( expr )
56              parentheses for grouping.
57
58       -a has higher precedence than -o.  Notice that all  the  operators  and
59       flags are separate arguments to test.  Notice also that parentheses are
60       meaningful to the Shell and must be escaped.
61

SEE ALSO

63       sh(1), find(1)
64
65
66
67                                                                       TEST(1)
Impressum