blob: 1f25f72ac714e1d0132ee9d23aae9956fffb0d65 (
plain) (
blame)
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
|
.Dd 2016-12-28
.Dt XTEST 1
.Os xtest
.Sh NAME
.Nm xtest
.Nd test file types and permissions of multiple files
.Sh SYNOPSIS
.Nm
.Oo Fl 0bcdefghkLprSstuwx Oc
.Oo \fB+bcdefghkLprSstuwx\fP Oc
.Oo Ar file ... Oc
.Sh DESCRIPTION
.Nm
tests the file types and permissions of each specified
file, if not file has been specified, a list file is read
from stdin.
.Pp
Each file that pass at least one of the tests is printed to
stdout.
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl 0
Use NUL byte instead of <newline> to delimit files in
both the input and the output.
.It Fl e
File exists.
.It Fl f | Fl d | Fl p | Fl hL | Fl S | Fl s | Fl b | Fl c
File exists and is a (regular file
.Op Fl f
| directory
.Op Fl d
| named pipe
.Op Fl p
| symbolic link
.Op Fl h | Fl L
| socket
.Op Fl S
| non-empty file
.Op Fl s
| block special
.Op Fl b
| character special
.Op Fl c ) .
.It Fl k | Fl g | Fl u | Fl r | Fl w | Fl x
File exists and has
.Xr ( sticky 1
.Op Fl k
|
.Xr setgid 2
.Op Fl g
|
.Xr setuid 4
.Op Fl u
|
.Xr read 4
.Op Fl r
|
.Xr write 2
.Op Fl w
|
.Xr execute 1
.Op Fl x )
permissions.
.It Fl t
Input is an file descriptor and is associated with a terminal.
.It \fB+e\fP
File does not exist
.It \fB+f\fP | \fB+d\fP | \fB+p\fP | \fB+hL\fP | \fB+S\fP | \fB+s\fP | \fB+b\fP | \fB+c\fP
File does not exist or is not a (regular file
.Op \fB+f\fP
| directory
.Op \fB+d\fP
| named pipe
.Op \fB+p\fP
| symbolic link
.Op \fB+h\fP | \fB+L\fP
| socket
.Op \fB+S\fP
| non-empty file
.Op \fB+s\fP
| block special
.Op \fB+b\fP
| character special
.Op \fB+c\fP ) .
.It \fB+k\fP | \fB+g\fP | \fB+u\fP | \fB+r\fP | \fB+w\fP | \fB+x\fP
File does not exist or does not has
.Xr ( sticky 1
.Op \fB+k\fP
|
.Xr setgid 2
.Op \fB+g\fP
|
.Xr setuid 4
.Op \fB+u\fP
|
.Xr read 4
.Op \fB+r\fP
|
.Xr write 2
.Op \fB+w\fP
|
.Xr execute 1
.Op \fB+x\fP )
permissions.
.It \fB+t\fP
Input is not a file descriptor or is not associated with a terminal.
.El
.Sh RATIONALE
\fB+\fP-flags are included because it is too cumbersome to use
.Xr comm 1 .
.Pp
Only one test need to pass because this allows the user to
represent the required condition in conjunctive normal form
by pipe together multiple instances of
.Nm xtest
for conjunction. Disjunctive normal form is not as simple.
.Sh SEE ALSO
.Xr test 1 ,
.Xr find 1 ,
.Xr xargs 1
|