summaryrefslogtreecommitdiff
path: root/man/test.1
blob: ffb6a7b09b135317d63efc0db5e3021a2851c256 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.35.
.TH TEST "1" "March 2007" "GNU coreutils 6.9" "User Commands"
.SH NAME
test \- check file types and compare values
.SH SYNOPSIS
.B test
\fIEXPRESSION\fR
.br
.B test

.br
.B [
\fIEXPRESSION \fR]
.br
.B [
]
.br
.B [
\fIOPTION\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
Exit with the status determined by EXPRESSION.
.TP
\fB\-\-help\fR
display this help and exit
.TP
\fB\-\-version\fR
output version information and exit
.PP
An omitted EXPRESSION defaults to false.  Otherwise,
EXPRESSION is true or false and sets exit status.  It is one of:
.TP
( EXPRESSION )
EXPRESSION is true
.TP
! EXPRESSION
EXPRESSION is false
.TP
EXPRESSION1 \fB\-a\fR EXPRESSION2
both EXPRESSION1 and EXPRESSION2 are true
.TP
EXPRESSION1 \fB\-o\fR EXPRESSION2
either EXPRESSION1 or EXPRESSION2 is true
.TP
\fB\-n\fR STRING
the length of STRING is nonzero
.TP
STRING
equivalent to \fB\-n\fR STRING
.TP
\fB\-z\fR STRING
the length of STRING is zero
.TP
STRING1 = STRING2
the strings are equal
.TP
STRING1 != STRING2
the strings are not equal
.TP
INTEGER1 \fB\-eq\fR INTEGER2
INTEGER1 is equal to INTEGER2
.TP
INTEGER1 \fB\-ge\fR INTEGER2
INTEGER1 is greater than or equal to INTEGER2
.TP
INTEGER1 \fB\-gt\fR INTEGER2
INTEGER1 is greater than INTEGER2
.TP
INTEGER1 \fB\-le\fR INTEGER2
INTEGER1 is less than or equal to INTEGER2
.TP
INTEGER1 \fB\-lt\fR INTEGER2
INTEGER1 is less than INTEGER2
.TP
INTEGER1 \fB\-ne\fR INTEGER2
INTEGER1 is not equal to INTEGER2
.TP
FILE1 \fB\-ef\fR FILE2
FILE1 and FILE2 have the same device and inode numbers
.TP
FILE1 \fB\-nt\fR FILE2
FILE1 is newer (modification date) than FILE2
.TP
FILE1 \fB\-ot\fR FILE2
FILE1 is older than FILE2
.TP
\fB\-b\fR FILE
FILE exists and is block special
.TP
\fB\-c\fR FILE
FILE exists and is character special
.TP
\fB\-d\fR FILE
FILE exists and is a directory
.TP
\fB\-e\fR FILE
FILE exists
.TP
\fB\-f\fR FILE
FILE exists and is a regular file
.TP
\fB\-g\fR FILE
FILE exists and is set\-group\-ID
.TP
\fB\-G\fR FILE
FILE exists and is owned by the effective group ID
.TP
\fB\-h\fR FILE
FILE exists and is a symbolic link (same as \fB\-L\fR)
.TP
\fB\-k\fR FILE
FILE exists and has its sticky bit set
.TP
\fB\-L\fR FILE
FILE exists and is a symbolic link (same as \fB\-h\fR)
.TP
\fB\-O\fR FILE
FILE exists and is owned by the effective user ID
.TP
\fB\-p\fR FILE
FILE exists and is a named pipe
.TP
\fB\-r\fR FILE
FILE exists and read permission is granted
.TP
\fB\-s\fR FILE
FILE exists and has a size greater than zero
.TP
\fB\-S\fR FILE
FILE exists and is a socket
.TP
\fB\-t\fR FD
file descriptor FD is opened on a terminal
.TP
\fB\-u\fR FILE
FILE exists and its set\-user\-ID bit is set
.TP
\fB\-w\fR FILE
FILE exists and write permission is granted
.TP
\fB\-x\fR FILE
FILE exists and execute (or search) permission is granted
.PP
Except for \fB\-h\fR and \fB\-L\fR, all FILE\-related tests dereference symbolic links.
Beware that parentheses need to be escaped (e.g., by backslashes) for shells.
INTEGER may also be \fB\-l\fR STRING, which evaluates to the length of STRING.
.PP
NOTE: your shell may have its own version of test and/or [, which usually supersedes
the version described here.  Please refer to your shell's documentation
for details about the options it supports.
.SH AUTHOR
Written by Kevin Braunsdorf and Matthew Bradburn.
.SH "REPORTING BUGS"
Report bugs to <bug\-coreutils@gnu.org>.
.SH COPYRIGHT
Copyright \(co 2007 Free Software Foundation, Inc.
.br
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
.SH "SEE ALSO"
The full documentation for
.B test
is maintained as a Texinfo manual.  If the
.B info
and
.B test
programs are properly installed at your site, the command
.IP
.B info test
.PP
should give you access to the complete manual.