| | @@ -25,1430 +31,510 @@ |
25 | 31 | .\" Updated and modified (findutils-4.4.2) Mon Dec 20 21:17:50 JST 2010 |
26 | 32 | .\" by Chonan Yoichi <cyoichi@maple.ocn.ne.jp> |
27 | 33 | .\" Modified Sun Jan 30 11:44:29 JST 2011 by Chonan Yoichi |
| 34 | +.\" Updated and modified (findutils-4.6.0) Sat Mar 3 11:18:22 JST 2018 |
| 35 | +.\" by Chonan Yoichi |
28 | 36 | .\" |
29 | 37 | .\" WORD expression 式 |
30 | | -.\" WORD predicate 述語 (式を構成するオプション、判別式、アクションを |
| 38 | +.\" WORD predicate 述語 (式を構成するオプション、検査、アクションを |
31 | 39 | .\" 一まとめにした言い方) |
32 | | -.\" WORD test(s) 判別式 |
| 40 | +.\" WORD test(s) 検査 (4.4.2 までは判別式と訳していたが、変更した) |
33 | 41 | .\" WORD directive 書式指定子 |
34 | 42 | .\" WORD access time アクセス日時 |
35 | 43 | .\" WORD status change time ステータス変更日時 |
36 | 44 | .\" WORD modification time 内容更新日時 |
37 | 45 | .\" WORD birth time (ファイルの)作成日時 |
38 | 46 | .\" |
39 | | -.TH FIND 1 \" -*- nroff -*- |
40 | | -.\"O .SH NAME |
| 47 | +.TH FIND 1 |
41 | 48 | .SH 名前 |
42 | | -.\"O find \- search for files in a directory hierarchy |
43 | 49 | find \- ディレクトリ階層をたどって、条件を満たすファイルを検索する |
44 | | -.\"O .SH SYNOPSIS |
45 | 50 | .SH 書式 |
46 | | -.B find |
47 | | -[\-H] [\-L] [\-P] [\-D debugopts] [\-Olevel] [path...] [expression] |
48 | | -.\"O .SH DESCRIPTION |
| 51 | +\fBfind\fP [\-H] [\-L] [\-P] [\-D debugopts] [\-Olevel] [starting\-point...] |
| 52 | +[expression] |
49 | 53 | .SH 説明 |
50 | | -.\"O This manual page |
51 | | -.\"O documents the GNU version of |
52 | | -.\"O .BR find . |
53 | | -このマニュアルページは GNU 版 |
54 | | -.B find |
55 | | -の使用法を説明している。 |
56 | | -.\"O GNU |
57 | | -.\"O .B find |
58 | | -.\"O searches the directory tree rooted at each given file name by |
59 | | -.\"O evaluating the given expression from left to right, according to the |
60 | | -.\"O rules of precedence (see section OPERATORS), until the outcome is |
61 | | -.\"O known (the left hand side is false for \fIand\fR operations, true for |
62 | | -.\"O \fIor\fR), at which point |
63 | | -.\"O .B find |
64 | | -.\"O moves on to the next file name. |
65 | | -.\"O .PP |
66 | | -GNU 版 |
67 | | -.B find |
68 | | -は、指定されたファイル名 (訳注: 上記「書式」における path...、 |
69 | | -普通はディレクトリを指定する) を始点とするディレクトリツリーを |
70 | | -一つづつ探索し、与えられた式 (expression) を、 |
71 | | -優先規則に従いつつ (「演算子」セクションを参照)、左から右へ |
72 | | -評価することによって検索を行う。 |
73 | | -結果が確定すると (たとえば、\fIand\fR 演算なら左辺が偽になった時点で、 |
74 | | -\fIor\fR 演算なら左辺が真になった時点で)、 |
75 | | -.B find |
76 | | -は検査の対象を次のファイル名に移す。 |
| 54 | +このマニュアルページは GNU 版 \fBfind\fP の使用法を説明している。 |
| 55 | +GNU 版 \fBfind\fP は、指定された探索開始点 (訳注: 探索の始点となるパス。上記書式の |
| 56 | +starting\-point...) 以下のディレクトリツリーを一つづつ探索し、与えられた式 |
| 57 | +(訳注: 上記書式の expression) を、優先規則に従いつつ (「演算子」セクションを参照)、 |
| 58 | +左から右へ評価することによって検索を行う。 式の結果が確定すると |
| 59 | +(たとえば、\fIand\fP 演算で左辺が偽になった場合や、\fIor\fP 演算で左辺が真になった場合など)、 |
| 60 | +\fBfind\fP は処理の対象を次のファイル名に移す。 |
| 61 | +探索開始点が指定されていない場合は、`.' が指定されたものと見なされる。 |
77 | 62 | .PP |
78 | | -.\"O If you are using |
79 | | -.\"O .B find |
80 | | -.\"O in an environment where security is important (for example if you are |
81 | | -.\"O using it to search directories that are writable by other users), you |
82 | | -.\"O should read the "Security Considerations" chapter of the findutils |
83 | | -.\"O documentation, which is called \fBFinding Files\fP and comes with |
84 | | -.\"O findutils. That document also includes a lot more detail |
85 | | -.\"O and discussion than this manual page, so you may find it a more useful |
86 | | -.\"O source of information. |
87 | | -もし |
88 | | -.B find |
89 | | -を使用しているのが、セキュリティの問題をおろそかにできない環境なら |
90 | | -(たとえば、 |
91 | | -.B find |
92 | | -を使って探索しているディレクトリが、自分以外のユーザにも |
93 | | -書き込み可能な場合など)、findutils 関連文書の |
94 | | -「Security Considerations」の章をお読みになるとよいだろう。 |
| 63 | +もし \fBfind\fP を使用しているのが、セキュリティの問題をおろそかにできない環境なら |
| 64 | +(たとえば、 \fBfind\fP を使って探索しているディレクトリが、自分以外のユーザにも書き込み可能な場合など)、 |
| 65 | +findutils 関連文書の 「Security Considerations」の章をお読みになるとよい。 |
95 | 66 | \fBFinding Files\fP という文書で、findutils に同梱されているはずだ |
96 | | -(訳注: \fBinfo "Finding Files"\fR や \fBinfo find\fR で読むことができる)。 |
97 | | -その文書では、ほかの点についてもこのマニュアルページより |
98 | | -はるかに詳しい説明や考察が行われているので、この文書以上に情報源として |
99 | | -お役に立つかもしれない。 |
100 | | -.\"O .SH OPTIONS |
| 67 | +(訳注: \fBinfo "Finding Files"\fP で読むことができる)。 |
| 68 | +その文書では、他の点についてもこのマニュアルページよりはるかに詳しい説明や考察が行われているので、 |
| 69 | +この文書以上に情報源としてお役に立つことだろう。 |
101 | 70 | .SH オプション |
102 | | -.\"O The |
103 | | -.\"O .BR \-H , |
104 | | -.\"O .B \-L |
105 | | -.\"O and |
106 | | -.\"O .B \-P |
107 | | -.\"O options control the treatment of symbolic |
108 | | -.\"O links. Command-line arguments following these are taken to be names |
109 | | -.\"O of files or directories to be examined, up to the first argument that |
110 | | -.\"O begins with `\-', or the argument `(' or `!'. That argument and any |
111 | | -.\"O following arguments are taken to be the expression describing what is |
112 | | -.\"O to be searched for. If no paths are given, the current directory is |
113 | | -.\"O used. If no expression is given, the expression |
114 | | -.\"O .B \-print |
115 | | -.\"O is used |
116 | | -.\"O (but you should probably consider using |
117 | | -.\"O .B \-print0 |
118 | | -.\"O instead, anyway). |
119 | | -.\"O .PP |
120 | | -.BR \-H , |
121 | | -.BR \-L , |
122 | | -.B \-P |
123 | | -というオプションは、シンボリックリンクをどう処理するかを決める。 |
124 | | -こうしたオプションに続くコマンドライン引き数は、探索場所となる |
125 | | -ファイル名やディレクトリ名と見なされる。ただし、それは、`\-' で始まる |
126 | | -引き数や、`(' とか `!' という引き数が、続いて現れるまでだ。 |
127 | | -そうした引き数、及びそれに続くいかなる引き数も、何を捜すべきかを |
128 | | -記述した式であると解釈される。パスが一つも指定されていない場合は、 |
129 | | -カレントディレクトリ以下が探索の対象になる。 |
130 | | -式が一つも指定されていない場合は、 |
131 | | -.B \-print |
132 | | -が式として使用される (もっとも、 |
133 | | -.B \-print |
134 | | -の代わりに、 |
135 | | -.B \-print0 |
136 | | -の使用を考えた方がよさそうだが)。 |
| 71 | +\fB\-H\fP, \fB\-L\fP, \fB\-P\fP というオプションは、シンボリックリンクをどう処理するかを決める。 |
| 72 | +こうしたオプションに続くコマンドライン引き数は、探索対象となるファイル名やディレクトリ名と見なされる。 |
| 73 | +ただし、それは、`\-' で始まる引き数や、`(' とか `!' という引き数が、続いて現れるまでだ。 |
| 74 | +そうした引き数、及びそれに続くいかなる引き数も、何を捜すべきかを記述した式であると解釈される。 |
| 75 | +探索開始点のパスが一つも指定されていない場合は、カレントディレクトリ以下が探索の対象になる。 |
| 76 | +また、式が一つも指定されていない場合は、\fB\-print\fP が式として使用される |
| 77 | +(もっとも、いかなる場合でも、\fB\-print\fP の代わりに \fB\-print0\fP |
| 78 | +の使用を考えた方が多分よいだろうが)。 |
137 | 79 | .PP |
138 | | -.\"O This manual page talks about `options' within the expression list. |
139 | | -.\"O These options control the behaviour of |
140 | | -.\"O .B find |
141 | | -.\"O but are specified immediately after the last path name. The five |
142 | | -.\"O `real' options |
143 | | -.\"O .BR \-H , |
144 | | -.\"O .BR \-L , |
145 | | -.\"O .BR \-P , |
146 | | -.\"O .B \-D |
147 | | -.\"O and |
148 | | -.\"O .B \-O |
149 | | -.\"O must appear before |
150 | | -.\"O the first path name, if at all. A double dash |
151 | | -.\"O .B \-\- |
152 | | -.\"O can also be used |
153 | | -.\"O to signal that any remaining arguments are not options (though |
154 | | -.\"O ensuring that all start points begin with either `./' or `/' is |
155 | | -.\"O generally safer if you use wildcards in the list of start points). |
156 | | -このマニュアルページで説明する「オプション」には、式の一部として |
157 | | -使われるものもある。そうしたオプションは、 |
158 | | -.B find |
159 | | -の動作を制御するものであり、指定する位置は最後のパス名の直後になる。 |
160 | | -これに対して、 |
161 | | -.BR \-H , |
162 | | -.BR \-L , |
163 | | -.BR \-P , |
164 | | -.BR \-D , |
165 | | -.B \-O |
166 | | -という五つの「本来」のオプションは、指定するなら、最初のパス名の前で |
167 | | -指定しなければならない。なお、ダッシュを二個重ねた |
168 | | -.B \-\- |
169 | | -を使用して、後に続く引き数がオプションではないことを明示することも |
170 | | -可能だ (それでも、探索の始点となるパス名のリストでワイルドカードを |
171 | | -使用するならば、始点のすべてが `./' か `/' で始まるように |
172 | | -しておいた方が、たいてい無難である)。 |
173 | | -.\"O .IP \-P |
| 80 | +このマニュアルページで説明する「オプション」には、式の一部として使われるものもある。 |
| 81 | +そうしたオプションは、\fBfind\fP の動作を制御するものであり、指定する位置は、探索開始点の最後のパス名のすぐ後になる。 |
| 82 | +これに対して、\fB\-H\fP, \fB\-L\fP, \fB\-P\fP, \fB\-D\fP, \fB\-O\fP |
| 83 | +という五つの「本来」のオプションは、指定するなら、最初のパス名の前で指定しなければならない。 |
| 84 | +なお、ダッシュを二個重ねた \fB\-\-\fP を使用して、後に続く引き数はオプションではないと明示することも可能だ |
| 85 | +(それでも、探索開始点となるパス名のリストでワイルドカードを使用するならば、 |
| 86 | +始点のすべてが `./' か `/' で始まるようにしておいた方が、たいてい無難である)。 |
174 | 87 | .IP \-P |
175 | | -.\"O Never follow symbolic links. This is the default behaviour. When |
176 | | -.\"O .B find |
177 | | -.\"O examines or prints information a file, and the file is a symbolic |
178 | | -.\"O link, the information used shall be taken from the properties of the |
179 | | -.\"O symbolic link itself. |
180 | | -.\"O |
181 | | -シンボリックリンクをまったくたどらない。これがデフォルトの動作である。 |
182 | | -.B find |
183 | | -がファイルの情報を調べたり表示したりする際に、そのファイルが |
184 | | -シンボリックリンクだったら、そのシンボリックリンクそのものの |
185 | | -プロパティから取得した情報が使用されることになる。 |
| 88 | +シンボリックリンクをまったくたどらない。これがデフォルトの動作である。\fBfind\fP |
| 89 | +がファイルの情報を調べたり表示したりする際に、そのファイルがシンボリックリンクだったら、 |
| 90 | +そのシンボリックリンクそのもののプロパティから取得した情報が使用されることになる。 |
186 | 91 | |
187 | | -.\"O .IP \-L |
188 | 92 | .IP \-L |
189 | | -.\"O Follow symbolic links. When |
190 | | -.\"O .B find |
191 | | -.\"O examines or prints information about files, the information used shall |
192 | | -.\"O be taken from the properties of the file to which the link points, not |
193 | | -.\"O from the link itself (unless it is a broken symbolic link or |
194 | | -.\"O .B find |
195 | | -.\"O is unable to examine the file to which the link points). Use of this |
196 | | -.\"O option implies |
197 | | -.\"O .BR \-noleaf . |
198 | | -.\"O If you later use the |
199 | | -.\"O .B \-P |
200 | | -.\"O option, |
201 | | -.\"O .B \-noleaf |
202 | | -.\"O will still be in effect. If |
203 | | -.\"O .B \-L |
204 | | -.\"O is in effect and |
205 | | -.\"O .B find |
206 | | -.\"O discovers a symbolic link to a subdirectory during its search, |
207 | | -.\"O the subdirectory pointed to by the symbolic link will be searched. |
208 | | -シンボリックリンクをたどる。 |
209 | | -.B find |
210 | | -がファイルの情報を調べたり表示したりする際に、 |
| 93 | +シンボリックリンクをたどる。\fBfind\fP がファイルの情報を調べたり表示したりする際に、 |
211 | 94 | リンク先のファイルのプロパティから取得した情報が使用されることになり、 |
212 | | -リンクそのものの情報は利用されない (ただし、 |
213 | | -シンボリックリンクがリンク切れしていたり、 |
214 | | -.B find |
215 | | -がリンク先のファイルを調べることができなかった場合は除く)。 |
216 | | -このオプションを使用すると、自動的に |
217 | | -.B \-noleaf |
218 | | -が指定される。 |
219 | | -後で |
220 | | -.B \-P |
221 | | -オプションを指定し直しても、 |
222 | | -.B \-noleaf |
223 | | -は依然として有効なままである。 |
224 | | -.B \-L |
225 | | -が有効になっているとき、 |
226 | | -.B find |
227 | | -が探索中にサブディレクトリを指すシンボリックリンクに出会うと、 |
| 95 | +リンクそのものの情報は利用されない (ただし、シンボリックリンクがリンク切れしていたり、 |
| 96 | +\fBfind\fP がリンク先のファイルを調べることができなかった場合は除く)。 |
| 97 | +このオプションを使用すると、自動的に \fB\-noleaf\fP が指定される。 |
| 98 | +後で \fB\-P\fP オプションを指定し直しても、\fB\-noleaf\fP は依然として有効なままである。 |
| 99 | +\fB\-L\fP が有効になっているとき、\fBfind\fP が探索中にサブディレクトリを指すシンボリックリンクに出会うと、 |
228 | 100 | そのシンボリックリンクが参照しているサブディレクトリが探索される。 |
229 | | -.\"O .IP |
230 | | -.\"O When the |
231 | | -.\"O .B \-L |
232 | | -.\"O option is in effect, the |
233 | | -.\"O .B \-type |
234 | | -.\"O predicate will always |
235 | | -.\"O match against the type of the file that a symbolic link points to |
236 | | -.\"O rather than the link itself (unless the symbolic link is broken). |
237 | | -.\"O Using |
238 | | -.\"O .B \-L |
239 | | -.\"O causes the |
240 | | -.\"O .B \-lname |
241 | | -.\"O and |
242 | | -.\"O .B \-ilname |
243 | | -.\"O predicates always to return |
244 | | -.\"O false. |
245 | | -.\"O |
246 | 101 | .IP |
247 | | -.B \-L |
248 | | -オプションが有効だと、述語 |
249 | | -.B \-type |
250 | | -は (訳注: 「述語 (predicate)」とは、式を構成するオプション、判別式、 |
251 | | -アクションなどの基本語彙を言う)、リンクそのものに対してではなく、 |
252 | | -常にシンボリックリンクが指しているファイルのタイプに対してマッチを |
253 | | -行うようになる (シンボリックリンクがリンク切れしている場合を除く)。 |
254 | | -.B \-L |
255 | | -を使用すると、述語 |
256 | | -.B \-lname |
257 | | -や |
258 | | -.B \-ilname |
259 | | -は常に偽を返す。 |
260 | | - |
261 | | -.\"O .IP \-H |
| 102 | +\fB\-L\fP オプションが有効だと、述語 \fB\-type\fP は |
| 103 | +(訳注: 「述語 (predicate)」とは、式を構成する基本要素、すなわち、オプション、検査、 |
| 104 | +アクションのこと)、シンボリックリンクそのものに対してではなく、 |
| 105 | +常にシンボリックリンクが指しているファイルのタイプに対してマッチを行うようになる |
| 106 | +(シンボリックリンクがリンク切れしている場合を除く)。 |
| 107 | +\fBfind\fP の実行中にシンボリックリンクがリンク切れになるようなアクションを行うと |
| 108 | +(たとえば、\fB\-delete\fP を使うと)、動作がわけのわからないものになるかもしれない。 |
| 109 | +\fB\-L\fP を使用すると、述語 \fB\-lname\fP や \fB\-ilname\fP は常に偽を返す。 |
| 110 | + |
262 | 111 | .IP \-H |
263 | | -.\"O Do not follow symbolic links, except while processing the command |
264 | | -.\"O line arguments. When |
265 | | -.\"O .B find |
266 | | -.\"O examines or prints information about files, the information used |
267 | | -.\"O shall be taken from the properties of the symbolic link itself. The |
268 | | -.\"O only exception to this behaviour is when a file specified on the |
269 | | -.\"O command line is a symbolic link, and the link can be resolved. For |
270 | | -.\"O that situation, the information used is taken from whatever the link |
271 | | -.\"O points to (that is, the link is followed). The information about the |
272 | | -.\"O link itself is used as a fallback if the file pointed to by the |
273 | | -.\"O symbolic link cannot be examined. If |
274 | | -.\"O .B \-H |
275 | | -.\"O is in effect and one of the |
276 | | -.\"O paths specified on the command line is a symbolic link to a directory, |
277 | | -.\"O the contents of that directory will be examined (though of course |
278 | | -.\"O \-maxdepth 0 would prevent this). |
279 | | -.\"O .P |
280 | | -コマンドライン上で指定された引き数を処理するとき以外、 |
281 | | -シンボリックリンクをたどらない。すなわち、原則として、 |
282 | | -.B find |
283 | | -がファイルの情報を調べたり表示したりする際に、シンボリックリンク |
284 | | -そのもののプロパティから取得した情報が、使用されることになる。 |
285 | | -ただし、この動作には例外が一つあって、それは、コマンドラインで |
286 | | -指定されたファイルがシンボリックリンクであり、そのリンクが |
287 | | -解決できるときだ。その場合は、リンク先が何であれ、そこから |
288 | | -取得した情報が使用され (つまり、リンクがたどられるわけだ)、 |
289 | | -シンボリックリンク自体の情報は、リンク先のファイルを調べることが |
290 | | -できなかったときの、控えの情報として使われる。 |
291 | | -.B \-H |
292 | | -が有効な場合に、コマンドラインで指定されたパスの中にディレクトリへの |
293 | | -シンボリックリンクがあったら、そのディレクトリの中身が |
294 | | -調べられることになる (もっとも、\-maxdepth 0 を指定すれば、 |
295 | | -当然ながら、この動作は抑制されることになるだろうが)。 |
| 112 | +コマンドライン上で指定された引き数を処理するとき以外、シンボリックリンクをたどらない。 |
| 113 | +すなわち、原則として、 \fBfind\fP がファイルの情報を調べたり表示したりする際に、 |
| 114 | +シンボリックリンクそのもののプロパティから取得した情報が使用されることになる。 |
| 115 | +ただし、この動作には例外が一つあり、それは、コマンドラインで指定されたファイルがシンボリックリンクであり、そのリンクが解決できる場合だ。 |
| 116 | +その場合は、リンク先が何であれ、そこから取得した情報が使用され |
| 117 | +(つまり、リンクがたどられる)、シンボリックリンク自体の情報は、リンク先のファイルを調べることができなかったときの、控えの情報として使用される。 |
| 118 | +なお、\fB\-H\fP が有効なとき、コマンドラインで指定されたパスの中に (訳注: つまり探索開始点の中に) |
| 119 | +ディレクトリへのシンボリックリンクがあった場合も、そのディレクトリの中身が調べられることになる |
| 120 | +(もっとも、\-maxdepth 0 を指定すれば、 当然ながら、この動作は抑制されることになるだろうが)。 |
296 | 121 | .P |
297 | | -.\"O If more than one of |
298 | | -.\"O .BR \-H , |
299 | | -.\"O .B \-L |
300 | | -.\"O and |
301 | | -.\"O .B \-P |
302 | | -.\"O is specified, each overrides the |
303 | | -.\"O others; the last one appearing on the command line takes effect. |
304 | | -.\"O Since it is the default, the |
305 | | -.\"O .B \-P |
306 | | -.\"O option should be considered to be in |
307 | | -.\"O effect unless either |
308 | | -.\"O .B \-H |
309 | | -.\"O or |
310 | | -.\"O .B \-L |
311 | | -.\"O is specified. |
312 | | -.\"O |
313 | | -一つ以上の |
314 | | -.BR \-H , |
315 | | -.BR \-L , |
316 | | -.B \-P |
317 | | -を指定した場合は、後のものが前のものを上書きする。 |
| 122 | +一つ以上の \fB\-H\fP, \fB\-L\fP, \fB\-P\fP を指定した場合は、後のものが前のものを上書きする。 |
318 | 123 | 従って、コマンドラインで最後に指定されたものが、効果を持つわけだ。 |
319 | | -.B \-P |
320 | | -はデフォルトなので、 |
321 | | -.B \-H |
322 | | -や |
323 | | -.B \-L |
324 | | -を指定しないかぎり、 |
325 | | -.B \-P |
| 124 | +\fB\-P\fP はデフォルトなので、\fB\-H\fP や \fB\-L\fP を指定しないかぎり、\fB\-P\fP |
326 | 125 | オプションが有効になっていると考えるべきである。 |
327 | 126 | |
328 | | -.\"O GNU |
329 | | -.\"O .B find |
330 | | -.\"O frequently stats files during the processing of the command line |
331 | | -.\"O itself, before any searching has begun. These options also affect how |
332 | | -.\"O those arguments are processed. Specifically, there are a number of |
333 | | -.\"O tests that compare files listed on the command line against a file we |
334 | | -.\"O are currently considering. In each case, the file specified on the |
335 | | -.\"O command line will have been examined and some of its properties will |
336 | | -.\"O have been saved. If the named file is in fact a symbolic link, and |
337 | | -.\"O the |
338 | | -.\"O .B \-P |
339 | | -.\"O option is in effect (or if neither |
340 | | -.\"O .B \-H |
341 | | -.\"O nor |
342 | | -.\"O .B \-L |
343 | | -.\"O were specified), the information used for the comparison will be taken from |
344 | | -.\"O the properties of the symbolic link. Otherwise, it will be taken from |
345 | | -.\"O the properties of the file the link points to. If |
346 | | -.\"O .B find |
347 | | -.\"O cannot follow the link (for example because it has insufficient |
348 | | -.\"O privileges or the link points to a nonexistent file) the properties of |
349 | | -.\"O the link itself will be used. |
350 | | -.\"O .P |
351 | | -GNU |
352 | | -.B find |
353 | | -は実際の探索に取りかかる前にコマンドラインの処理を行うが、 |
354 | | -その際 stat システムコールを使ってファイルの情報を調べることが |
355 | | -よくある。上述のオプションは、そのとき引き数がどう処理されるかにも |
356 | | -影響を与える。具体的に説明しよう。いくつのの判別式では、 |
357 | | -コマンドラインで指定したファイルを目下検査の対象になっているファイルと |
358 | | -照合する。いづれの判別式でも、コマンドラインで指定したファイルは、 |
359 | | -情報が調べられた後、そのプロパティのいくつかが保存されることになる。 |
360 | | -名前を指定したファイルが実際にはシンボリックリンクであるとき、 |
361 | | -.B \-P |
362 | | -オプションが有効な場合は (言い換えれば、 |
363 | | -.B \-H |
364 | | -と |
365 | | -.B \-L |
366 | | -のどちらのオプションも指定されていない場合は)、 |
367 | | -照合に使用される情報は、シンボリックリンクのプロパティから |
368 | | -取得したものである。それ以外の場合、使用されるのはリンク先のファイルの |
369 | | -プロパティから取得した情報だ。ただし、 |
370 | | -.B find |
371 | | -が (たとえば、権限が不十分だとか、リンク先のファイルが |
372 | | -存在しないとかの理由で) リンクをたどれない場合は、 |
373 | | -リンクそのもののプロパティが使われることになる。 |
| 127 | +GNU \fBfind\fP は実際の探索に取りかかる前にコマンドラインの処理を行うが、 |
| 128 | +その際 stat システムコールを使ってファイルの情報を調べることがよくある。 |
| 129 | +上述のオプションは、そのとき引き数がどう処理されるかにも影響を与える。 |
| 130 | +具体的に説明しよう。いくつかの検査では、コマンドラインで指定したファイルを目下検査の対象になっているファイルと照合する。 |
| 131 | +いづれの検査でも、コマンドラインで指定したファイルは、情報が調べられた後、そのプロパティのいくつかが保存されることになる。 |
| 132 | +名前を指定したファイルが実際にはシンボリックリンクであるとき、\fB\-P\fP オプションが有効な場合は |
| 133 | +(すなわち、 \fB\-H\fP と \fB\-L\fP のどちらのオプションも指定されていない場合は)、 |
| 134 | +照合に使用される情報は、シンボリックリンクのプロパティから取得したものである。 |
| 135 | +それ以外の場合、使用されるのはリンク先のファイルのプロパティから取得した情報だ。 |
| 136 | +ただし、\fBfind\fP が (たとえば、権限が不十分だとか、リンク先のファイルが存在しないとかの理由で) |
| 137 | +リンクをたどれない場合は、リンクそのもののプロパティが使われることになる。 |
374 | 138 | .P |
375 | | -.\"O When the |
376 | | -.\"O .B \-H |
377 | | -.\"O or |
378 | | -.\"O .B \-L options are in effect, any symbolic links listed |
379 | | -.\"O as the argument of |
380 | | -.\"O .B \-newer |
381 | | -.\"O will be dereferenced, and the timestamp |
382 | | -.\"O will be taken from the file to which the symbolic link points. The |
383 | | -.\"O same consideration applies to |
384 | | -.\"O .BR \-newerXY , |
385 | | -.\"O .B \-anewer |
386 | | -.\"O and |
387 | | -.\"O .BR \-cnewer . |
388 | | -.\"O |
389 | | -.B \-H |
390 | | -や |
391 | | -.B \-L |
392 | | -オプションが有効な場合は、 |
393 | | -.B \-newer |
394 | | -の引き数として指定されたのがシンボリックリンクなら、その参照がたどられて、 |
395 | | -リンク先のファイルからタイムスタンプが取得されることになる。 |
396 | | -同じことが、 |
397 | | -.BR \-newerXY , |
398 | | -.BR \-anewer , |
399 | | -.B \-cnewer |
400 | | -についても言える。 |
401 | | - |
402 | | -.\"O The |
403 | | -.\"O .B \-follow |
404 | | -.\"O option has a similar effect to |
405 | | -.\"O .BR \-L , |
406 | | -.\"O though it takes |
407 | | -.\"O effect at the point where it appears (that is, if |
408 | | -.\"O .B \-L |
409 | | -.\"O is not used but |
410 | | -.\"O .B \-follow |
411 | | -.\"O is, any symbolic links appearing after |
412 | | -.\"O .B \-follow |
413 | | -.\"O on the |
414 | | -.\"O command line will be dereferenced, and those before it will not). |
415 | | -.\"O |
416 | | -式の一部として使用される |
417 | | -.B \-follow |
418 | | -オプションには |
419 | | -.B \-L |
420 | | -と同様の効果があるが、それが現れた位置から有効になるという点が |
421 | | -異なる (すなわち、 |
422 | | -.B \-L |
423 | | -が使われずに、 |
424 | | -.B \-follow |
425 | | -が使われた場合、 |
426 | | -.B \-follow |
427 | | -より後で指定されたいかなるシンボリックリンクも参照がたどられるが、 |
| 139 | +\fB\-H\fP や \fB\-L\fP オプションが有効な場合は、 |
| 140 | +\fB\-newer\fP の引き数として指定されたのがシンボリックリンクなら、 |
| 141 | +その参照がたどられて、リンク先のファイルからタイムスタンプが取得されることになる。 |
| 142 | +同じことが、 \fB\-newerXY\fP, \fB\-anewer\fP, \fB\-cnewer\fP についても言える。 |
| 143 | + |
| 144 | +式の一部として使用される \fB\-follow\fP オプションには \fB\-L\fP と同様の効果があるが、 |
| 145 | +それが現れた位置から有効になるという点が異なる |
| 146 | +(すなわち、\fB\-L\fP が使われずに、\fB\-follow\fP が使われた場合、 |
| 147 | +\fB\-follow\fP より後で指定されたいかなるシンボリックリンクも参照がたどられるが、 |
428 | 148 | その前に指定されたシンボリックリンクは参照がたどられない)。 |
429 | 149 | |
430 | | -.\"O .IP "\-D debugoptions" |
431 | | -.\"O Print diagnostic information; this can be helpful to diagnose problems |
432 | | -.\"O with why |
433 | | -.\"O .B find |
434 | | -.\"O is not doing what you want. The list of debug options should be comma |
435 | | -.\"O separated. Compatibility of the debug options is not guaranteed |
436 | | -.\"O between releases of findutils. For a complete list of valid debug |
437 | | -.\"O options, see the output of |
438 | | -.\"O .B find \-D |
439 | | -.\"O .BR help . |
440 | | -.\"O Valid debug options include |
441 | 150 | .IP "\-D debugoptions" |
442 | | -診断用の情報を出力する。 |
443 | | -.B find |
444 | | -が期待どおりに動いてくれないとき、問題の原因追求に役立つことがある。 |
445 | | -デバッグオプションを複数指定するときは、コンマで区切る。 |
| 151 | +診断用の情報を出力する。\fBfind\fP が期待どおりに動いてくれないとき、 |
| 152 | +問題の原因追求に役立つことがある。デバッグオプションを複数指定するときは、コンマで区切る。 |
446 | 153 | findutils のバージョンの間で、デバッグオプションの互換性は保証されていない。 |
447 | | -有効な全デバッグオプションのリストについては、 |
448 | | -.B find \-D help |
449 | | -の出力を見るとよい。 |
| 154 | +有効な全デバッグオプションのリストについては、\fBfind \-D help\fP の出力を見るとよい。 |
450 | 155 | 有効なデバッグオプションの中には、以下のものがある。 |
451 | | -.\"O .RS |
452 | | -.\"O .IP help |
453 | | -.\"O Explain the debugging options |
454 | 156 | .RS |
455 | 157 | .IP help |
456 | 158 | デバッグ用オプションを説明する。 |
457 | | -.\"O .IP tree |
458 | | -.\"O Show the expression tree in its original and optimised form. |
459 | 159 | .IP tree |
460 | 160 | 式の構造 (expression tree) をオリジナルな形と最適化した形で示す。 |
461 | | -.\"O .IP stat |
462 | | -.\"O Print messages as files are examined with the |
463 | | -.\"O .B stat |
464 | | -.\"O and |
465 | | -.\"O .B lstat |
466 | | -.\"O system calls. The |
467 | | -.\"O .B find |
468 | | -.\"O program tries to minimise such calls. |
469 | 161 | .IP stat |
470 | | -.B stat |
471 | | -や |
472 | | -.B lstat |
473 | | -システムコールを使ってファイルが調べられたとき、 |
474 | | -メッセージを表示する。 |
475 | | -.B find |
476 | | -プログラムは、そうしたシステムコールの回数を最少にしようとする。 |
477 | | -.\"O .IP opt |
478 | | -.\"O Prints diagnostic information relating to the optimisation of the |
479 | | -.\"O expression tree; see the \-O option. |
| 162 | +\fBstat\fP や \fBlstat\fP システムコールを使ってファイルを調べたとき、メッセージを表示する。 |
| 163 | +\fBfind\fP プログラムは、そうしたシステムコールの回数を最少にしようとする。 |
480 | 164 | .IP opt |
481 | | -式の構造 (expression tree) の最適化に関する診断情報を表示する。 |
482 | | -\-O オプションを参照。 |
483 | | -.\"O .IP rates |
484 | | -.\"O Prints a summary indicating how often each predicate succeeded or |
485 | | -.\"O failed. |
| 165 | +式の構造 (expression tree) の最適化に関する診断情報を表示する。\-O オプションを参照。 |
486 | 166 | .IP rates |
487 | 167 | 各述語が何回成功し、何回失敗したかを示す情報を要約して表示する。 |
488 | | -.\"O .RE |
489 | | -.\"O .IP \-Olevel |
490 | | -.\"O Enables query optimisation. The |
491 | | -.\"O .B find |
492 | | -.\"O program reorders tests to speed up execution while preserving the |
493 | | -.\"O overall effect; that is, predicates with side effects are not |
494 | | -.\"O reordered relative to each other. The optimisations performed at each |
495 | | -.\"O optimisation level are as follows. |
496 | 168 | .RE |
497 | 169 | .IP \-Olevel |
498 | | -検査の最適化を有効にする。 |
499 | | -.B find |
500 | | -プログラムは、実行速度を上げるために判別式の順序を並べ替えるとき、 |
501 | | -全体的な効果を維持しようとする。すなわち、付加的な作用のある |
502 | | -述語同士については、相互の相対的な順序を変更しないということだ。 |
| 170 | +問い合わせの最適化を有効にする。\fBfind\fP プログラムは、全体的な効果を維持しつつ、検査の順序を並べ替えることによって、実行速度を上げる。 |
| 171 | +すなわち、付加的な作用のある述語同士については、相互の相対的な順序を変更しないということだ。 |
503 | 172 | 各最適化レベルで行われる最適化は、以下のとおりである。 |
504 | | -.\"O .RS |
505 | | -.\"O .IP 0 |
506 | | -.\"O Equivalent to optimisation level 1. |
507 | 173 | .RS |
508 | 174 | .IP 0 |
509 | 175 | 最適化レベル 1 と同じである。 |
510 | | -.\"O .IP 1 |
511 | | -.\"O This is the default optimisation level and corresponds to the |
512 | | -.\"O traditional behaviour. Expressions are reordered so that tests based |
513 | | -.\"O only on the names of files (for example |
514 | | -.\"O .B \-name |
515 | | -.\"O and |
516 | | -.\"O .BR \-regex ) |
517 | | -.\"O are performed first. |
518 | 176 | .IP 1 |
519 | 177 | これはデフォルトの最適化レベルであり、伝統的な動作に当たる。 |
520 | | -式を並べ替えるとき、ファイル名にのみ基づいた判別式 (たとえば、 |
521 | | -.B \-name |
522 | | -や |
523 | | -.BR \-regex ) |
524 | | -が先に実行されるようにする。 |
525 | | -.\"O .IP 2 |
526 | | -.\"O Any |
527 | | -.\"O .B \-type |
528 | | -.\"O or |
529 | | -.\"O .B \-xtype |
530 | | -.\"O tests are performed after any tests based only on the names of files, |
531 | | -.\"O but before any tests that require information from the inode. On many |
532 | | -.\"O modern versions of Unix, file types are returned by |
533 | | -.\"O .B readdir() |
534 | | -.\"O and so these predicates are faster to evaluate than predicates which |
535 | | -.\"O need to stat the file first. |
| 178 | +式を並べ替えるとき、ファイル名にのみ基づいた検査 |
| 179 | +(たとえば、 \fB\-name\fP や \fB\-regex\fP) が先に実行されるようにする。 |
536 | 180 | .IP 2 |
537 | | -判別式 |
538 | | -.B \-type |
539 | | -や |
540 | | -.B \-xtype |
541 | | -の実行は、ファイル名に基づいたいかなる判別式よりも後になるが、 |
542 | | -inode から情報を取得する必要があるどんな判別式よりも先になる。 |
543 | | -最近の Unix には |
544 | | -.B readdir() |
545 | | -関数でファイルタイプを取得できるものが多い。 |
546 | | -それ故、こうした述語は、まず stat 関数でファイル情報を取得する |
547 | | -必要がある述語よりも、評価に時間がかからないのである。 |
548 | | -.\"O .IP 3 |
549 | | -.\"O At this optimisation level, the full cost-based query optimiser is |
550 | | -.\"O enabled. The order of tests is modified so that cheap (i.e. fast) |
551 | | -.\"O tests are performed first and more expensive ones are performed later, |
552 | | -.\"O if necessary. Within each cost band, predicates are evaluated earlier |
553 | | -.\"O or later according to whether they are likely to succeed or not. For |
554 | | -.\"O .BR \-o , |
555 | | -.\"O predicates which are likely to succeed are evaluated earlier, and for |
556 | | -.\"O .BR \-a , |
557 | | -.\"O predicates which are likely to fail are evaluated earlier. |
| 181 | +検査 \fB\-type\fP や \fB\-xtype\fP の実行は、ファイル名のみに基づいたいかなる検査よりも後になるが、 |
| 182 | +inode から情報を取得する必要があるどんな検査よりも先になる。 |
| 183 | +最近の Unix には \fBreaddir()\fP 関数でファイルタイプを取得できるものが多いので、 |
| 184 | +こうした述語は、stat 関数でファイルの情報を取得するところから始めなければならない述語よりも、評価に時間がかからないのである。 |
| 185 | +なお、\fB\-fstype\fP \fIFOO\fP という述語を使った場合に、 |
| 186 | +\fBfind\fP の起動時に既知になっていない (すなわち、`/etc/mtab' に存在しない) |
| 187 | +ファイルシステムのタイプ \fIFOO\fP を指定すると、\fB\-fstype\fP \fIFOO\fP は |
| 188 | +\fB\-false\fP と同じことになる。 |
558 | 189 | .IP 3 |
559 | | -この最適化レベルでは、コストに基づいた検査の最適化を徹底して行う機能が |
560 | | -有効になる。判別式の順序が必要なら変更され、コストのかからない |
561 | | -(すなわち、速い) 判別式が先に行われ、よりコストのかかる判別式が |
562 | | -後回しにされる。コストがほぼ同じ場合には、その述語が真を返しそうか、 |
563 | | -偽を返しそうかによって、評価の順番が変わってくる。 |
564 | | -.B or |
565 | | -演算では、真を返しそうな述語が先に評価され、 |
566 | | -.B and |
567 | | -演算では、偽になりそうな述語が先に評価されるのである。 |
568 | | -.\"O .RE |
569 | | -.\"O .IP |
570 | | -.\"O The cost-based optimiser has a fixed idea of how likely any given test |
571 | | -.\"O is to succeed. In some cases the probability takes account of the |
572 | | -.\"O specific nature of the test (for example, |
573 | | -.\"O .B \-type f |
574 | | -.\"O is assumed to be more likely to succeed than |
575 | | -.\"O .BR "\-type c" ). |
576 | | -.\"O The cost-based optimiser is currently being evaluated. If it does |
577 | | -.\"O not actually improve the performance of |
578 | | -.\"O .BR find , |
579 | | -.\"O it will be removed again. Conversely, optimisations that prove to be |
580 | | -.\"O reliable, robust and effective may be enabled at lower optimisation |
581 | | -.\"O levels over time. However, the default behaviour (i.e. optimisation |
582 | | -.\"O level 1) will not be changed in the 4.3.x release series. The |
583 | | -.\"O findutils test suite runs all the tests on |
584 | | -.\"O .B find |
585 | | -.\"O at each optimisation level and ensures that the result is the same. |
586 | | -.\"O .P |
| 190 | +この最適化レベルでは、コストに基づいた問い合わせの最適化を徹底して行う機能が有効になる。 |
| 191 | +検査の順序が必要なら変更され、コストのかからない (すなわち、速い) 検査が先に行われて、よりコストのかかる検査が後回しにされる。 |
| 192 | +コストがほぼ同じ場合には、その述語が真を返しそうか、偽を返しそうかによって、評価の順番が変わってくる。 |
| 193 | +\fBor\fP 演算では、真を返しそうな述語が先に評価され、\fBand\fP 演算では、偽になりそうな述語が先に評価されるのである。 |
587 | 194 | .RE |
588 | 195 | .IP |
589 | | -コストに基づいた最適化機能は、ある判別式が真を返す確率について |
590 | | -一定の考えを持っている。場合によっては、その確率について、 |
591 | | -問題のテストの特性が考慮されることもある (たとえば、 |
592 | | -.B \-type f |
593 | | -は、 |
594 | | -.B \-type c |
595 | | -よりも、真になる可能性が高いと見なされる)。 |
| 196 | +コストに基づいた最適化機能は、ある検査が真を返す確率について一定の考えを持っている。 |
| 197 | +場合によっては、その確率について、問題のテストの特性が考慮されることもある |
| 198 | +(たとえば、 \fB\-type f\fP は、 \fB\-type c\fP よりも、真になる可能性が高いと見なされる)。 |
596 | 199 | コストに基づいた最適化機能は、現在のところその効果を評価中である。 |
597 | | -もし、それによって |
598 | | -.B find |
599 | | -の性能が実際に向上することがなければ、捨てられることになるだろう。 |
600 | | -反対に、信頼性があり、問題を起こしにくく、効果的であることが |
601 | | -はっきりした最適化は、そのうち下位の最適化レベルでも採用される |
602 | | -かもしれない。とは言え、リリース 4.3.x のシリーズでは、 |
603 | | -デフォルトの動作 (すなわち、最適化レベル 1) を変更する予定はない。 |
604 | | -なお、findutils のソースに付属するテスト集は、そのテストのすべてを |
605 | | -各最適化レベルの |
606 | | -.B find |
607 | | -で実行して、どの最適化レベルでも結果が同じになることを保証している。 |
608 | | -.\"O .SH EXPRESSIONS |
609 | | -.\"O The expression is made up of options (which affect overall operation |
610 | | -.\"O rather than the processing of a specific file, and always return |
611 | | -.\"O true), tests (which return a true or false value), and actions (which |
612 | | -.\"O have side effects and return a true or false value), all separated by |
613 | | -.\"O operators. |
614 | | -.\"O .B \-and |
615 | | -.\"O is assumed where the operator is omitted. |
616 | | -.\"O |
617 | | -.SH "式 (EXPRESSIONS)" |
618 | | -式は、オプション、判別式、アクションから構成されている |
619 | | -(訳注: オプション、判別式、アクションをまとめて、「述語 (predicate)」と呼ぶ)。 |
620 | | -オプションは特定のファイルの処理よりもむしろ作業全体に影響し、 |
621 | | -常に真を返す。判別式が返す値は、真のこともあれば、偽のこともある。 |
622 | | -アクションには付加的な作用があり、真または偽を返す。 |
623 | | -こうした式の要素は、みな演算子で区切られる。演算子が省略された場所には、 |
624 | | -.B \-and |
625 | | -があるものと見なされる。 |
626 | | - |
627 | | -.\"O If the expression contains no actions other than |
628 | | -.\"O .BR \-prune , |
629 | | -.\"O .B \-print |
630 | | -.\"O is |
631 | | -.\"O performed on all files for which the expression is true. |
632 | | -.\"O |
633 | | -式の中に |
634 | | -.B \-prune |
635 | | -以外のアクションが存在しない場合は、 |
636 | | -式の結果が真になったすべてのファイルに対して |
637 | | -.B \-print |
638 | | -が実行される。 |
639 | | -.\"O .SS OPTIONS |
640 | | -.\"O .P |
641 | | -.\"O All options always return true. Except for |
642 | | -.\"O .BR \-daystart , |
643 | | -.\"O .B \-follow |
644 | | -.\"O and |
645 | | -.\"O .BR \-regextype , |
646 | | -.\"O the options affect all tests, including tests specified |
647 | | -.\"O before the option. This is because the options are processed when the |
648 | | -.\"O command line is parsed, while the tests don't do anything until files |
649 | | -.\"O are examined. The |
650 | | -.\"O .BR \-daystart , |
651 | | -.\"O .B \-follow |
652 | | -.\"O and |
653 | | -.\"O .B \-regextype |
654 | | -.\"O options are different in this respect, and have an effect only on tests which |
655 | | -.\"O appear later in the command line. Therefore, for clarity, it is best |
656 | | -.\"O to place them at the beginning of the expression. A warning is issued |
657 | | -.\"O if you don't do this. |
658 | | -.\"O |
659 | | -.SS オプション |
| 200 | +もし、それによって \fBfind\fP の性能が実際に向上することがなければ、捨てられることになるだろう。 |
| 201 | +反対に、信頼性があり、問題を起こしにくく、効果的であることがはっきりした最適化は、 |
| 202 | +そのうち下位の最適化レベルでも採用されるかもしれない。とは言え、リリース 4.3.x |
| 203 | +のシリーズでは、 デフォルトの動作 (すなわち、最適化レベル 1) を変更する予定はない。 |
| 204 | +なお、findutils のソースに付属するテスト集は、そのテストのすべてを各最適化レベルの |
| 205 | +\fBfind\fP で実行して、どの最適化レベルでも結果が同じになることを保証している。 |
660 | 206 | .P |
661 | | -すべてのオプションは常に真を返す。 |
662 | | -.BR \-daystart , |
663 | | -.BR \-follow , |
664 | | -.B \-regextype |
665 | | -を除いて、そのほかのオプションは、そのオプションより前に |
666 | | -指定された判別式も含め、すべての判別式に影響を及ぼす。 |
667 | | -これは、オプションの処理は、コマンドラインが解析されるときに |
668 | | -行われるのに対して、判別式の方は、ファイルが調べられるまで |
669 | | -何もしないからである。 |
670 | | -.BR \-daystart , |
671 | | -.BR \-follow , |
672 | | -.B \-regextype |
673 | | -の各オプションはこの点で異なっている。この三つのオプションは、 |
674 | | -コマンドラインで自分より後に指定された判別式にしか影響を |
675 | | -及ぼさないのだ。従って、混乱を避けるためには、 |
676 | | -.BR \-daystart , |
677 | | -.BR \-follow , |
678 | | -.B \-regextype |
679 | | -以外のオプションは、 |
680 | | -式の先頭部に置いた方がよい。そうしないと、警告が発せられる。 |
681 | | - |
682 | | -.\"O .IP \-d |
683 | | -.\"O A synonym for \-depth, for compatibility with FreeBSD, NetBSD, MacOS X and OpenBSD. |
684 | | -.\"O |
685 | | -.IP \-d |
686 | | -\-depth と同じ。FreeBSD, NetBSD, MacOS X, OpenBSD との互換性のためにある。 |
| 207 | +.SH "式 (EXPRESSION)" |
| 208 | +コマンドライン上で探索開始点 (starting\-point) のリストの後ろに続く部分は、「式 (\fIexpression\fP)」である。 |
| 209 | +式は、言わば問い合わせの細目のようなものであり、 |
| 210 | +どういうファイルがマッチするのかと、そのマッチしたファイルをどう処理するのかを記述している。 |
| 211 | +式は一連の要素からなっている (訳注: このマニュアルでは、そうした式の要素、 |
| 212 | +特にオプション、検査、アクションをまとめて「述語 (predicate)」と呼んでいる)。 |
| 213 | + |
| 214 | +.IP "検査 (Tests)" |
| 215 | +検査は、通常、考慮の対象になっているファイルの何らかの属性情報 |
| 216 | +(property) に基づいて、真または偽の値を返す。たとえば、\fB\-empty\fP |
| 217 | +という検査は、対象になっているファイルが空の場合にのみ、真になる。 |
| 218 | + |
| 219 | +.RS |
| 220 | +.IP "[\fB訳注\fP]:" 8 |
| 221 | +バージョン 4.4.2 までの翻訳では、この \fBTests\fP |
| 222 | +を「判別式」と訳してきたが、今回は素直に「検査」と訳すことにした。同じものである。 |
| 223 | +.RE |
| 224 | +.IP "アクション (Actions)" |
| 225 | +アクションには付加的な作用があり (たとえば、標準出力に何かを表示するなど)、 |
| 226 | +通常、その作用の実行に成功したか失敗したかに基づいて、真または偽を返す。 |
| 227 | +たとえば、\fB\-print\fP というアクションは、対象になっているファイルの名前を標準出力に表示する。 |
| 228 | + |
| 229 | +.IP "グローバルオプション (Global options)" |
| 230 | +グローバルオプションは、検査やアクションがコマンドライン中のどこで指定されていても、 |
| 231 | +その動作に影響を与える。また、グルーバルオプションは、常に真を返す。 |
| 232 | +たとえば、\fB\-depth\fP オプションを指定すると、\fBfind\fP は、ファイルシステムをたどるとき、 |
| 233 | +深い方から先に (depth\-first order) 処理していくことになる |
| 234 | +(訳注: 下記の \fB\-depth\fP の説明を参照)。 |
| 235 | + |
| 236 | +.IP "位置オプション (Positional options)" |
| 237 | +位置オプションが影響を与えるのは、それより後に続く検査やアクションに対してだけである。 |
| 238 | +また、位置オプションは常に真を返す。たとえば、\fB\-regextype\fP オプションは、その位置が意味を持ち、 |
| 239 | +コマンドライン上でそれより後に現れる正規表現に対して、正規表現のどの方言かを指定することになる。 |
| 240 | + |
| 241 | +.IP "演算子 (Operators)" |
| 242 | +演算子は、式を構成する事項同士を結びつけるものである。 |
| 243 | +演算子には、\fB\-o\fP (論理 OR を意味する) や \fB\-a\fP (論理 AND を意味する) などがある。 |
| 244 | +演算子がないところには、\fB\-a\fP があるものと見なされる。 |
| 245 | + |
| 246 | +.P |
| 247 | +式の中に \fB\-prune\fP や \fB\-print\fP 以外のアクションがまったく存在しない場合は、 |
| 248 | +式全体の結果が真になったすべてのファイルに対して \fB\-print\fP が実行される。 |
| 249 | + |
| 250 | +\fB\-delete\fP というアクションはオプションのようにも働く |
| 251 | +(自動的に \fB\-depth\fP を有効にするからである)。 |
| 252 | + |
| 253 | +.SS 位置オプション |
| 254 | +位置オプションは、常に真を返す。 |
| 255 | +位置オプションが影響を与えるのは、コマンドライン上でそれより後に現れる検査に対してだけである。 |
687 | 256 | |
688 | | -.\"O .IP \-daystart |
689 | | -.\"O Measure times (for |
690 | | -.\"O .BR \-amin , |
691 | | -.\"O .BR \-atime , |
692 | | -.\"O .BR \-cmin , |
693 | | -.\"O .BR \-ctime , |
694 | | -.\"O .BR \-mmin , |
695 | | -.\"O and |
696 | | -.\"O .BR \-mtime ) |
697 | | -.\"O from the beginning of today rather than from 24 hours ago. This |
698 | | -.\"O option only affects tests which appear later on the command line. |
699 | | -.\"O |
700 | 257 | .IP \-daystart |
701 | | -.BR \-amin , |
702 | | -.BR \-atime , |
703 | | -.BR \-cmin , |
704 | | -.BR \-ctime , |
705 | | -.BR \-mmin , |
706 | | -.B \-mtime |
707 | | -において、今日 (すなわち 0 日前) の始まりを今現在から 24 時間前ではなく、 |
708 | | -コマンド実行当日の 0 時にする。 |
709 | | -このオプションが影響を及ぼすのは、コマンドラインで自分より後に |
710 | | -指定された判別式だけである。 |
| 258 | +\fB\-amin\fP, \fB\-atime\fP, \fB\-cmin\fP, \fB\-ctime\fP, \fB\-mmin\fP, \fB\-mtime\fP |
| 259 | +において、今日 (すなわち 0 日前) の始まりを今現在から 24 時間前ではなく、コマンド実行当日の 0 時にする。 |
| 260 | +このオプションが影響を及ぼすのは、コマンドラインで自分より後に指定された検査に対してだけである。 |
| 261 | + |
711 | 262 | .RS |
712 | | -.IP "[訳注]:" 8 |
| 263 | +.IP "[\fB訳注\fP]:" 8 |
713 | 264 | .BR \-amin , |
714 | 265 | .BR \-cmin , |
715 | | -.B \-mmin |
716 | | -のことも考慮に入れると、次のように言えばよいのかもしれない。 |
717 | | -デフォルトでは時間を計算するときの基準を |
718 | | -今現在に置くが、 |
| 266 | +.BR \-mmin |
| 267 | +のことも考慮するなら、「デフォルトでは時間を計算するときの基点を今現在に置くが、 |
719 | 268 | .B \-daystart |
720 | | -を指定すると、時間計算の基準が今日の 24:00 になる。 |
| 269 | +を指定すると、時間計算の基点が今日の 24:00 になる」と考えれば、 |
| 270 | +わかりやすいかもしれない。 |
721 | 271 | .RE |
722 | 272 | |
723 | | -.\"O .IP \-depth |
724 | | -.\"O Process each directory's contents before the directory itself. The |
725 | | -.\"O \-delete action also implies |
726 | | -.\"O .BR \-depth . |
727 | | -.\"O |
| 273 | +.IP \-follow |
| 274 | +非推奨である。 \fB\-L\fP オプションを代わりに使う方がよい。 |
| 275 | +シンボリックリンクをたどる。 \fB\-noleaf\fP が自動的に設定される。 |
| 276 | +\fB\-follow\fP オプションが影響を及ぼすのは、コマンドラインで自分より後に指定された検査に対してだけである。 |
| 277 | +\fB\-H\fP や \fB\-L\fP オプションが指定されていない場合、\fB\-follow\fP |
| 278 | +オプションの位置によって述語 \fB\-newer\fP の動作が変わってくる。 |
| 279 | +\fB\-newer\fP が \fB\-follow\fP の後に来れば、\fB\-newer\fP |
| 280 | +の引き数として指定されたいかなるファイルも、それがシンボリックリンクなら、リンクをたどられることになるわけだ。 |
| 281 | +同じことが \fB\-newerXY\fP, \fB\-anewer\fP, \fB\-cnewer\fP についても言える。 |
| 282 | +同様に、述語 \fB\-type\fP も、シンボリックリンクそのものではなく、 |
| 283 | +必ずシンボリックリンクが参照しているファイルのタイプに対してマッチを行うようになる。 |
| 284 | +\fB\-follow\fP を使用すると、述語 \fB\-lname\fP と \fB\-ilname\fP は常に偽を返す。 |
| 285 | + |
| 286 | +.IP "\-regextype \fItype\fP" |
| 287 | +検査 \fB\-regex\fP と \fB\-iregex\fP が理解する正規表現の文法を変更する。 |
| 288 | +このオプションよりコマンドラインの後方で指定する \fB\-regex\fP などに対して効果がある。 |
| 289 | +どういう正規表現のタイプが使えるかを知るには、\fB\-regextype\fP \fBhelp\fP を使用すればよい。 |
| 290 | +様々なタイプの正規表現が、どんなもので、どこが違うかについては、\fBfind\fP の Texinfo |
| 291 | +文書に説明がある (「関連項目」を参照)。 |
| 292 | + |
| 293 | +.IP "\-warn, \-nowarn" |
| 294 | +警告メッセージの表示、非表示を切り替える。 |
| 295 | +ここで言う警告とは、もっぱらコマンドラインの使用法に関するものであり、\fBfind\fP |
| 296 | +がディレクトリを探索中に出会うかもしれない何らかの状況に関するものではない。 |
| 297 | +デフォルトの動作は、標準入力が tty であれば、\fB\-warn\fP であり、 |
| 298 | +それ以外の場合は、\fB\-nowarn\fP である。 |
| 299 | +コマンドラインの使用法に関する警告メッセージが生ずる場合でも、\fBfind\fP |
| 300 | +の終了ステータスは影響を受けない。 |
| 301 | +なお、環境変数 POSIXLY_CORRECT が設定され、しかも \fB\-warn\fP まで指定された場合に、 |
| 302 | +警告を出すとしても、どの警告を出すかは決まっていない |
| 303 | +(訳注: POSIX の規定では、\fBfind\fP は基本的に、エラーメッセージは出しても、警告メッセージは出さないことになっている。 |
| 304 | +だから、POSIXLY_CORRECT と \fB\-warn\fP の両方を指定するのは、使用法に混乱があるのである。 |
| 305 | +ちなみに、手元の 4.6.0 では警告は出ない)。 |
| 306 | + |
| 307 | +.SS グローバルオプション |
| 308 | +グローバルオプションは常に真を返す。 |
| 309 | +グローバルオプションは、コマンドライン上でそれよりも前にある検査に対しても効果を持つ。 |
| 310 | +混乱を避けるためには、グローバルオプションは、コマンドライン上で、探索開始点のリストの後ろ、 |
| 311 | +検査や位置オプションやアクションが現れる前に指定すべきである。 |
| 312 | +グローバルオプションを他の場所で指定すると、\fBfind\fP |
| 313 | +は「混乱の元になりかねない」旨の警告メッセージを出す。 |
| 314 | + |
| 315 | +グローバルオプションの位置は、探索開始点のリストより後ろである。だから、\fB\-L\fP |
| 316 | +などとは、まったく別種のオプションである。 |
| 317 | + |
| 318 | +.IP \-d |
| 319 | +\-depth と同じ。FreeBSD, NetBSD, MacOS X, OpenBSD との互換性のためにある。 |
| 320 | + |
728 | 321 | .IP \-depth |
729 | 322 | ディレクトリそのものより先に、ディレクトリの中身を処理する。 |
730 | | -アクション |
731 | | -.B \-delete |
732 | | -を使用すると、 |
733 | | -.B \-depth |
734 | | -オプションも自動的に設定される。 |
735 | | - |
736 | | -.\"O .IP \-follow |
737 | | -.\"O Deprecated; use the |
738 | | -.\"O .B \-L |
739 | | -.\"O option instead. Dereference symbolic links. |
740 | | -.\"O Implies |
741 | | -.\"O .BR \-noleaf . |
742 | | -.IP \-follow |
743 | | -非推奨である。 |
744 | | -.B \-L |
745 | | -オプションを代わりに使う方がよい。シンボリックリンクをたどる。 |
746 | | -.B \-noleaf |
747 | | -が自動的に設定される。 |
748 | | -.\"O The |
749 | | -.\"O .B \-follow |
750 | | -.\"O option affects only those tests which |
751 | | -.\"O appear after it on the command line. Unless the |
752 | | -.\"O .B \-H |
753 | | -.\"O or |
754 | | -.\"O .B \-L |
755 | | -.\"O option has |
756 | | -.\"O been specified, the position of the |
757 | | -.\"O .B \-follow |
758 | | -.\"O option changes the behaviour of the |
759 | | -.\"O .B \-newer |
760 | | -.\"O predicate; any files listed as the argument |
761 | | -.\"O of |
762 | | -.\"O .B \-newer |
763 | | -.\"O will be dereferenced if they are symbolic links. The same |
764 | | -.\"O consideration applies to |
765 | | -.\"O .BR \-newerXY , |
766 | | -.\"O .B \-anewer |
767 | | -.\"O and |
768 | | -.\"O .BR \-cnewer . |
769 | | -.B \-follow |
770 | | -オプションが影響を及ぼすのは、コマンドラインで自分より後に指定された |
771 | | -判別式だけである。 |
772 | | -.B \-H |
773 | | -や |
774 | | -.B \-L |
775 | | -オプションが指定されていない場合、 |
776 | | -.B \-follow |
777 | | -オプションの位置によって述語 |
778 | | -.B \-newer |
779 | | -の動作が変わってくる。 |
780 | | -.B \-newer |
781 | | -が |
782 | | -.B -follow |
783 | | -の後に来れば、 |
784 | | -.B \-newer |
785 | | -の引き数として指定されたいかなるファイルも、それがシンボリックリンクなら、 |
786 | | -リンクをたどられることになるわけだ。同じことが |
787 | | -.BR \-newerXY , |
788 | | -.BR \-anewer , |
789 | | -.B \-cnewer |
790 | | -についても言える。 |
791 | | -.\"O Similarly, the |
792 | | -.\"O .B \-type |
793 | | -.\"O predicate will always match against the type of the file |
794 | | -.\"O that a symbolic link points to rather than the link itself. Using |
795 | | -.\"O .B \-follow |
796 | | -.\"O causes the |
797 | | -.\"O .B \-lname and |
798 | | -.\"O .B \-ilname |
799 | | -.\"O predicates always to return false. |
800 | | -.\"O |
801 | | -同様に、述語 |
802 | | -.B \-type |
803 | | -も、シンボリックリンクそのものではなく、必ずシンボリックリンクが |
804 | | -参照しているファイルのタイプに対してマッチを行うようになる。 |
805 | | -.B \-follow |
806 | | -を使用すると、述語 |
807 | | -.B \-lname |
808 | | -と |
809 | | -.B \-ilname |
810 | | -は常に偽を返す。 |
811 | | - |
812 | | -.\"O .IP "\-help, \-\-help" |
813 | | -.\"O Print a summary of the command-line usage of |
814 | | -.\"O .B find |
815 | | -.\"O and exit. |
816 | | -.\"O |
| 323 | +アクション \fB\-delete\fP を使用すると、\fB\-depth\fP オプションも自動的に設定される。 |
| 324 | + |
817 | 325 | .IP "\-help, \-\-help" |
818 | | -.B find |
819 | | -のコマンドラインの使用法をざっと説明して終了する。 |
820 | | - |
821 | | -.\"O .IP \-ignore_readdir_race |
822 | | -.\"O Normally, \fBfind\fR will emit an error message when it fails to stat a file. |
823 | | -.\"O If you give this option and a file is deleted between the time \fBfind\fR |
824 | | -.\"O reads the name of the file from the directory and the time it tries to stat |
825 | | -.\"O the file, no error message will be issued. This also applies to files |
826 | | -.\"O or directories whose names are given on the command line. This option takes |
827 | | -.\"O effect at the time the command line is read, which means that you cannot search |
828 | | -.\"O one part of the filesystem with this option on and part of it with this option |
829 | | -.\"O off (if you need to do that, you will need to issue two \fBfind\fR commands |
830 | | -.\"O instead, one with the option and one without it). |
831 | | -.\"O |
| 326 | +\fBfind\fP のコマンドラインの使用法をざっと説明して終了する。 |
| 327 | + |
832 | 328 | .IP \-ignore_readdir_race |
833 | | -通常、\fBfind\fR は stat 関数でファイル情報を取得できなかったとき、 |
834 | | -エラーメッセージを吐くことになっている。 |
835 | | -ところが、このオプションを指定した場合は、\fBfind\fR が |
836 | | -ディレクトリからファイル名を読み込んでから、そのファイルに対して |
837 | | -stat 関数を実行しようとするまでの間に、ファイルが消去されても、 |
838 | | -エラーは表示されない。この動作は、コマンドラインで名前を指定した |
839 | | -ファイルやディレクトリに対しても適用される。このオプションは |
840 | | -コマンドラインを読み込む際に有効になるので、ファイルシステムの |
841 | | -ある部分をこのオプションを有効にして探索し、別の部分はこのオプションを |
842 | | -無効にして探索するといったことはできない (そうしたことをやりたかったら、 |
843 | | -\fBfind\fR コマンドを二回実行する必要があるだろう。一回は、 |
844 | | -このオプションを付けて、もう一回はこのオプションなしで)。 |
845 | | - |
846 | | -.\"O .IP "\-maxdepth \fIlevels\fR" |
847 | | -.\"O Descend at most \fIlevels\fR (a non-negative integer) levels of |
848 | | -.\"O directories below the command line arguments. |
849 | | -.\"O .B \-maxdepth 0 |
850 | | -.\"O means only apply the tests and actions to the command line arguments. |
851 | | -.\"O |
852 | | -.IP "\-maxdepth \fIlevels\fR" |
853 | | -コマンドライン引き数として指定したパスから最大 \fIlevels\fR 段階下の |
854 | | -ディレクトリまで探索する (\fIlevels\fR は非負の整数)。 |
855 | | -.B \-maxdepth 0 |
856 | | -は、判別式やアクションの対象にするのは、 |
857 | | -コマンドライン引き数だけであることを意味する。 |
858 | | - |
859 | | -.\"O .IP "\-mindepth \fIlevels\fR" |
860 | | -.\"O Do not apply any tests or actions at levels less than \fIlevels\fR (a |
861 | | -.\"O non-negative integer). |
862 | | -.\"O .B \-mindepth 1 |
863 | | -.\"O means process all files except the command line arguments. |
864 | | -.\"O |
865 | | -.IP "\-mindepth \fIlevels\fR" |
866 | | - コマンドライン引き数として指定したパスから少なくとも \fIlevels\fR 段階 |
867 | | -ディレクトリを下降するまで、どんな判別式やアクションも行わない |
868 | | -(\fIlevels\fR は非負の整数)。 |
869 | | -.B \-mindepth 1 |
870 | | -を指定すると、コマンドラインの引き数を除くすべてファイルを処理する。 |
871 | | - |
872 | | -.\"O .IP \-mount |
873 | | -.\"O Don't descend directories on other filesystems. An alternate name for |
874 | | -.\"O .BR \-xdev , |
875 | | -.\"O for compatibility with some other versions of |
876 | | -.\"O .BR find . |
877 | | -.\"O |
| 329 | +通常、\fBfind\fP は stat 関数でファイル情報を取得できなかったとき、 |
| 330 | +エラーメッセージを出すことになっている。 |
| 331 | +ところが、このオプションを指定した場合は、 |
| 332 | +\fBfind\fP がディレクトリからファイル名を読み込んでから、そのファイルに対して |
| 333 | +stat 関数を実行しようとするまでの間に、ファイルが消去されても、エラーは表示されない。 |
| 334 | +この動作は、コマンドラインで名前を指定したファイルやディレクトリに対しても適用される。 |
| 335 | +このオプションは コマンドラインを読み込む際に有効になるので、 |
| 336 | +ファイルシステムのある部分をこのオプションを有効にして探索し、 |
| 337 | +別の部分はこのオプションを無効にして探索するといったことはできない |
| 338 | +(そうしたことをやりたかったら、 \fBfind\fP コマンドを二回実行する必要があるだろう。 |
| 339 | +一回目は、このオプションを付けて、もう一回はこのオプションなしで)。 |
| 340 | + |
| 341 | +.IP "\-maxdepth \fIlevels\fP" |
| 342 | +探索開始点から最大 \fIlevels\fP 段階下のディレクトリまで探索する (\fIlevels\fP は非負の整数)。 |
| 343 | +\fB\-maxdepth 0\fP を指定すると、検査やアクションの対象になるのは、探索開始点だけになる。 |
| 344 | +.IP "\-mindepth \fIlevels\fP" |
| 345 | +探索開始点から少なくとも \fIlevels\fP |
| 346 | +段階ディレクトリを下降するまで、いかなる検査やアクションも行わない (\fIlevels\fP は非負の整数)。 |
| 347 | +\fB\-mindepth 1\fP を指定すると、探索開始点を除くすべてのファイルを処理することになる。 |
| 348 | + |
878 | 349 | .IP \-mount |
879 | | -ほかのファイルシステムにあるディレクトリを探索しない。これは |
880 | | -.B \-xdev |
881 | | -の別名であり、系統の違う |
882 | | -.B find |
883 | | -との互換性のためにある。 |
| 350 | +ほかのファイルシステムにあるディレクトリを探索しない。これは \fB\-xdev\fP |
| 351 | +の別名であり、系統の違う \fBfind\fP との互換性のためにある。 |
884 | 352 | |
885 | | -.\"O .IP \-noignore_readdir_race |
886 | | -.\"O Turns off the effect of |
887 | | -.\"O .BR \-ignore_readdir_race . |
888 | | -.\"O |
889 | 353 | .IP \-noignore_readdir_race |
890 | | -.B \-ignore_readdir_race |
891 | | -の効果を無効にする。 |
892 | | - |
893 | | -.\"O .IP "\-noleaf" |
894 | | -.\"O Do not optimize by assuming that directories contain 2 fewer |
895 | | -.\"O subdirectories than their hard link count. This option is needed when |
896 | | -.\"O searching filesystems that do not follow the Unix directory-link |
897 | | -.\"O convention, such as CD-ROM or MS-DOS filesystems or AFS volume mount |
898 | | -.\"O points. Each directory on a normal Unix filesystem has at least 2 |
899 | | -.\"O hard links: its name and its `.' entry. Additionally, its |
900 | | -.\"O subdirectories (if any) each have a `..' entry linked to that |
901 | | -.\"O directory. When |
902 | | -.\"O .B find |
903 | | -.\"O is examining a directory, after it has statted 2 fewer subdirectories |
904 | | -.\"O than the directory's link count, it knows that the rest of the entries |
905 | | -.\"O in the directory are non-directories (`leaf' files in the directory |
906 | | -.\"O tree). If only the files' names need to be examined, there is no need |
907 | | -.\"O to stat them; this gives a significant increase in search speed. |
908 | | -.\"O |
909 | | -.IP "\-noleaf" |
910 | | -「ディレクトリのハードリンク数から 2 を引いたものが、そのディレクトリに |
911 | | -含まれるサブディレクトリの数である」とする最適化動作を行わない。 |
| 354 | +\fB\-ignore_readdir_race\fP の効果を無効にする。 |
| 355 | + |
| 356 | +.IP \-noleaf |
| 357 | +「ディレクトリのハードリンク数から 2 を引いたものが、そのディレクトリに含まれるサブディレクトリの数である」とする最適化動作を行わない。 |
912 | 358 | このオプションが必要になるのは、ディレクトリとリンクの関係について |
913 | | -Unix の流儀に従わないファイルシステムを探索するときだ。 |
914 | | -たとえば、CD-ROM や MS-DOS のファイルシステムとか、AFS ボリュームの |
915 | | -マウントポイントなどを探索するときである。 |
916 | | -通常の Unix ファイルシステムでは、各ディレクトリは少なくとも |
917 | | -2 個のハードリンクを持っている。ディレクトリ名のエントリと、 |
918 | | -そのディレクトリ中の `.' エントリである。さらに、そのディレクトリに |
919 | | -サブディレクトリがあれば、サブディレクトリそれぞれに、親ディレクトリに |
920 | | -ハードリンクした '..' エントリが存在する。 |
921 | | -.B find |
922 | | -としては、ディレクトリを調べる際に、ディレクトリのリンク数より 2 少ない |
923 | | -数だけサブディレクトリを stat 関数で調べた時点で、ディレクトリ中の |
924 | | -残りのエントリはディレクトリではない (ディレクトリツリー中の |
925 | | -`leaf 葉っぱ' ファイルである) とわかるわけである。 |
926 | | -もし、調べるのがファイル名だけで充分なら、ファイルに対して stat 関数を |
927 | | -実行する必要はない。そこで、この動作により、検索速度が |
928 | | -いちじるしく向上するわけだ。 |
929 | | - |
930 | | -.\"O .IP "\-regextype \fItype\fR" |
931 | | -.\"O Changes the regular expression syntax understood by |
932 | | -.\"O .B \-regex |
933 | | -.\"O and |
934 | | -.\"O .B \-iregex |
935 | | -.\"O tests which occur later on the command line. Currently-implemented |
936 | | -.\"O types are emacs (this is the default), posix-awk, posix-basic, |
937 | | -.\"O posix-egrep and posix-extended. |
938 | | -.\"O |
939 | | -.IP "\-regextype \fItype\fR" |
940 | | -判別式 |
941 | | -.B \-regex |
942 | | -と |
943 | | -.B \-iregex |
944 | | -が理解する正規表現の文法を変更する。 |
945 | | -このオプションよりコマンドラインの後方で指定する |
946 | | -.B \-regex |
947 | | -などに対して効果がある。 |
948 | | -現在実装されている文法のタイプには、emacs (デフォルトである), |
949 | | -posix-awk, posix-basic, posix-egrep, posix-extended がある。 |
950 | | - |
951 | | -.\"O .IP "\-version, \-\-version" |
952 | | -.\"O Print the \fBfind\fR version number and exit. |
953 | | -.\"O |
| 359 | +Unix の流儀に従わないファイルシステムを探索するときだ。たとえば、CD\-ROM や |
| 360 | +MS\-DOS のファイルシステムとか、AFS ボリュームのマウントポイントなどを探索するときである。 |
| 361 | +通常の Unix ファイルシステムでは、各ディレクトリは少なくとも 2 個のハードリンクを持っている。 |
| 362 | +ディレクトリ名のエントリと、そのディレクトリ中の `.' エントリである。 |
| 363 | +さらに、そのディレクトリにサブディレクトリがあれば、 |
| 364 | +サブディレクトリそれぞれに、親ディレクトリにハードリンクした `..\&' エントリが存在する。 |
| 365 | +そこで、\fBfind\fP としては、ディレクトリを調べる際に、ディレクトリのハードリンク数より |
| 366 | +2 だけ少ない数のサブディレクトリを stat 関数で調べた時点で、ディレクトリ中の残りのエントリはディレクトリではない |
| 367 | +(ディレクトリツリー中の枝ではなく、「葉っぱ (leaf)]」ファイルである) とわかるわけだ。 |
| 368 | +もし、調べるのがファイル名だけで充分なら、ファイルに対して stat 関数を実行する必要はもうない。 |
| 369 | +そこで、この最適化動作によって、検索速度がいちじるしく向上するわけである。 |
| 370 | + |
954 | 371 | .IP "\-version, \-\-version" |
955 | | -\fBfind\fR のバージョンを表示して終了する。 |
956 | | - |
957 | | -.\"O .IP "\-warn, \-nowarn" |
958 | | -.\"O Turn warning messages on or off. These warnings apply only to the |
959 | | -.\"O command line usage, not to any conditions that |
960 | | -.\"O .B find |
961 | | -.\"O might encounter when it searches directories. The default behaviour |
962 | | -.\"O corresponds to |
963 | | -.\"O .B \-warn |
964 | | -.\"O if standard input is a tty, and to |
965 | | -.\"O .B \-nowarn |
966 | | -.\"O otherwise. |
967 | | -.\"O |
968 | | -.IP "\-warn, \-nowarn" |
969 | | -警告メッセージの表示、非表示を切り替える。こうしたメッセージは、 |
970 | | -もっぱらコマンドラインの使用法に関するものであり、 |
971 | | -.B find |
972 | | -がディレクトリを探索中に出会うかもしれない何らかの状況に |
973 | | -関するものではない。デフォルトの動作は、標準入力が tty であれば、 |
974 | | -.B \-warn |
975 | | -であり、それ以外の場合は、 |
976 | | -.B \-nowarn |
977 | | -である。 |
978 | | - |
979 | | -.\"O .IP \-xdev |
980 | | -.\"O Don't descend directories on other filesystems. |
981 | | -.\"O |
| 372 | +\fBfind\fP のバージョンを表示して終了する。 |
| 373 | + |
982 | 374 | .IP \-xdev |
983 | 375 | ほかのファイルシステムにあるディレクトリを探索しない。 |
984 | 376 | |
985 | | -.\"O .SS TESTS |
986 | | -.\"O Some tests, for example |
987 | | -.\"O .B \-newerXY |
988 | | -.\"O and |
989 | | -.\"O .BR -samefile , |
990 | | -.\"O allow comparison between the file currently being examined and some |
991 | | -.\"O reference file specified on the command line. When these tests are |
992 | | -.\"O used, the interpretation of the reference file is determined by the |
993 | | -.\"O options |
994 | | -.\"O .BR \-H , |
995 | | -.\"O .B \-L |
996 | | -.\"O and |
997 | | -.\"O .B \-P |
998 | | -.\"O and any previous |
999 | | -.\"O .BR \-follow , |
1000 | | -.\"O but the reference file is only examined once, at the time the command |
1001 | | -.\"O line is parsed. If the reference file cannot be examined (for |
1002 | | -.\"O example, the |
1003 | | -.\"O .BR stat (2) |
1004 | | -.\"O system call fails for it), an error message is issued, and |
1005 | | -.\"O .B find |
1006 | | -.\"O exits with a nonzero status. |
1007 | | -.\"O .P |
1008 | | -.SS 判別式 (TESTS) |
1009 | | -判別式の中には、たとえば |
1010 | | -.B \-newerXY |
1011 | | -や |
1012 | | -.B \-samefile |
1013 | | -のように、現在検査の対象になっているファイルと、コマンドラインで指定した |
1014 | | -リファレンスファイルとを比較することになっているものがある。 |
1015 | | -そうしたリファレンスファイルの実体が何になるかは、 |
1016 | | -.BR \-H , |
1017 | | -.BR \-L , |
1018 | | -.B \-P |
1019 | | -といったオプションや、先行する |
1020 | | -.B \-follow |
1021 | | -の存在によって決まってくる。 |
1022 | | -ただし、リファレンスファイルが調べられるのは、一回だけであり、 |
1023 | | -それはコマンドラインの解析が行われるときである。 |
1024 | | -リファレンスファイルを調べることができない場合は (たとえば、 |
1025 | | -それに対する |
1026 | | -.BR stat (2) |
1027 | | -システムコールに失敗するなど)、エラーメッセージが表示され、 |
1028 | | -.B find |
1029 | | -は 0 以外のステータスで終了する。 |
| 377 | +.SS "検査 (TESTS)" |
| 378 | +検査の中には、たとえば \fB\-newerXY\fP や \fB\-samefile\fP |
| 379 | +のように、現在検査の対象になっているファイルと、コマンドラインで指定したリファレンスファイルとを比較することになっているものがある。 |
| 380 | +そうしたリファレンスファイルが実際には何を指すかは、\fB\-H\fP, \fB\-L\fP, \fB\-P\fP |
| 381 | +といったオプションや、先行する \fB\-follow\fP の存在によって決まってくる。 |
| 382 | +ただし、リファレンスファイルが調べられるのは、一回だけであり、それはコマンドラインの解析が行われるときである。 |
| 383 | +リファレンスファイルを調べることができない場合は (たとえば、それに対する \fBstat\fP(2) |
| 384 | +システムコールに失敗するなど)、エラーメッセージが表示され、\fBfind\fP は |
| 385 | +0 以外のステータスで終了する。 |
1030 | 386 | .P |
1031 | | -.\"O Numeric arguments can be specified as |
1032 | | -.\"O .IP \fI+n\fP |
1033 | | -.\"O for greater than |
1034 | | -.\"O .IR n , |
1035 | | -.\"O .IP \fI\-n\fP |
1036 | | -.\"O for less than |
1037 | | -.\"O .IR n , |
1038 | | -.\"O .IP \fIn\fP |
1039 | | -.\"O for exactly |
1040 | | -.\"O .IR n . |
1041 | | -.\"O .P |
1042 | | -.\"O |
1043 | 387 | 数値の引き数は、以下の形で指定することができる。 |
1044 | 388 | .IP \fI+n\fP |
1045 | | -.I n |
1046 | | -を越える数であることを意味する。 |
| 389 | +\fIn\fP より大きい。 |
1047 | 390 | .IP \fI\-n\fP |
1048 | | -.I n |
1049 | | -未満であることを意味する。 |
| 391 | +\fIn\fP より小さい。 |
1050 | 392 | .IP \fIn\fP |
1051 | | -ぴったり |
1052 | | -.I n |
1053 | | -であることを意味する。 |
1054 | | - |
1055 | | -.\"O .IP "\-amin \fIn\fR" |
1056 | | -.\"O File was last accessed \fIn\fR minutes ago. |
1057 | | -.\"O |
1058 | | -.IP "\-amin \fIn\fR" |
1059 | | -ファイルの最終アクセス日時が \fIn\fR 分前であれば真。 |
1060 | | - |
1061 | | -.\"O .IP "\-anewer \fIfile\fR" |
1062 | | -.\"O File was last accessed more recently than \fIfile\fR was modified. If |
1063 | | -.\"O \fIfile\fR is a symbolic link and the |
1064 | | -.\"O .B \-H |
1065 | | -.\"O option or the |
1066 | | -.\"O .B \-L |
1067 | | -.\"O option is in effect, the access time of the file it points to is |
1068 | | -.\"O always used. |
1069 | | -.\"O |
1070 | | -.IP "\-anewer \fIfile\fR" |
1071 | | -ファイルの最終アクセス日時が、\fIfile\fR の内容更新日時よりも |
1072 | | -新しければ、真を返す。引き数 \fIfile\fR がシンボリックリンクで、 |
1073 | | -しかも |
1074 | | -.B \-H |
1075 | | -や |
1076 | | -.B \-L |
1077 | | -オプションが有効になっている場合は、リンク先のファイルの内容更新日時が |
1078 | | -比較に使用されることになる。 |
1079 | | -.\" (訳注: "If \fIfile\fR is a symbolic link" の \fIfile\fR は |
1080 | | -.\" 直前にある "than \fIfile\fR was modified" の \fIfile\fR と |
1081 | | -.\" 同じだろうから -- すなわち、-anewer の引き数だろうから -- |
1082 | | -.\" "the access time of the file it points" の access time を |
1083 | | -.\" modification time に修正しないと、つじつまが合わなくなる。 |
1084 | | -.\" ほぼ同じことが、-cnewer や -newer の訳についても言える) |
1085 | | - |
1086 | | -.\"O .IP "\-atime \fIn\fR" |
1087 | | -.\"O File was last accessed \fIn\fR*24 hours ago. |
1088 | | -.\"O When find figures out how many 24-hour periods ago the file |
1089 | | -.\"O was last accessed, any fractional part is ignored, so to match |
1090 | | -.\"O .B \-atime |
1091 | | -.\"O .BR +1 , |
1092 | | -.\"O a file has to have been accessed at least |
1093 | | -.\"O .I two |
1094 | | -.\"O days ago. |
1095 | | -.\"O |
1096 | | -.IP "\-atime \fIn\fR" |
1097 | | -ファイルの最終アクセス日時が \fIn\fR 日前ならば、真を返す。 |
1098 | | -ファイルの最終アクセス日時が何日前かを計算する際、現在時刻との時間差を |
1099 | | -24 で割った余りは切り捨てられる。従って、 |
1100 | | -.B \-atime +1 |
1101 | | -にマッチするためには、 |
1102 | | -ファイルは少なくとも二日前にアクセスされていなければならない。 |
1103 | | - |
1104 | | -.\"O .IP "\-cmin \fIn\fR" |
1105 | | -.\"O File's status was last changed \fIn\fR minutes ago. |
1106 | | -.\"O |
1107 | | -.IP "\-cmin \fIn\fR" |
1108 | | -ファイルの最終ステータス変更日時が \fIn\fR 分前ならば真。 |
1109 | | - |
1110 | | -.\"O .IP "\-cnewer \fIfile\fR" |
1111 | | -.\"O File's status was last changed more recently than \fIfile\fR was |
1112 | | -.\"O modified. If \fIfile\fR is a symbolic link and the |
1113 | | -.\"O .B \-H |
1114 | | -.\"O option or the |
1115 | | -.\"O .B \-L |
1116 | | -.\"O option is in effect, the status-change time of the file it points |
1117 | | -.\"O to is always used. |
1118 | | -.\"O |
1119 | | -.IP "\-cnewer \fIfile\fR" |
1120 | | -ファイルの最終ステータス変更日時が、\fIfile\fR の内容更新日時よりも |
1121 | | -新しければ、真を返す。引き数 \fIfile\fR がシンボリックリンクで、 |
1122 | | -しかも |
1123 | | -.B \-H |
1124 | | -や |
1125 | | -.B \-L |
1126 | | -オプションが有効になっている場合は、リンク先のファイルの内容更新日時が |
1127 | | -比較に使用されることになる。 |
1128 | | - |
1129 | | -.\"O .IP "\-ctime \fIn\fR" |
1130 | | -.\"O File's status was last changed \fIn\fR*24 hours ago. |
1131 | | -.\"O See the comments for |
1132 | | -.\"O .B \-atime |
1133 | | -.\"O to understand how rounding affects the interpretation of file status |
1134 | | -.\"O change times. |
1135 | | -.\"O |
1136 | | -.IP "\-ctime \fIn\fR" |
1137 | | -ファイルの最終ステータス変更日時が \fIn\fR 日前ならば、真を返す。 |
1138 | | -何日前かを計算する際に、現在時刻との時間差を 24 で割った余りを |
1139 | | -切り捨てることが、ファイルのステータス変更日時の解釈にどんな影響を |
1140 | | -及ぼすかについては、 |
1141 | | -.B \-atime |
1142 | | -の説明を見てほしい。 |
1143 | | - |
1144 | | -.\"O .IP \-empty |
1145 | | -.\"O File is empty and is either a regular file or a directory. |
1146 | | -.\"O |
| 393 | +ちょうど \fIn\fP。 |
| 394 | +.P |
| 395 | + |
| 396 | +.IP "\-amin \fIn\fP" |
| 397 | +ファイルの最終アクセス日時が \fIn\fP 分前であれば真を返す。 |
| 398 | + |
| 399 | +.IP "\-anewer \fIfile\fP" |
| 400 | +ファイルの最終アクセス日時が、\fIfile\fP の内容更新日時よりも新しければ、真を返す。 |
| 401 | +引き数 \fIfile\fP がシンボリックリンクで、しかも \fB\-H\fP や \fB\-L\fP オプションが有効になっている場合は、 |
| 402 | +リンク先のファイルの内容更新日時が比較に使用されることになる。 |
| 403 | + |
| 404 | +.IP "\-atime \fIn\fP" |
| 405 | +ファイルの最終アクセス日時が、基点となる時刻から計算して \fIn\fP 日前に当たれば、真を返す |
| 406 | +(訳注: 基点となる時刻は、デフォルトでは \fBfind\fP を実行している今現在である)。 |
| 407 | +ファイルの最終アクセス日時が何日前かを計算する際、基点となる時刻との時間差を |
| 408 | +24 時間で割って出た小数点以下の端数は無視される。従って、\fB\-atime\fP \fB+1\fP |
| 409 | +にマッチするためには、ファイルは少なくとも二日前にアクセスされていなければならない。 |
| 410 | +(訳注: デフォルトの動作のように、現在時刻から数えて 24 時間前から 48 時間前までを |
| 411 | +1 日前とするのではなく、今日の午前 0 時以前の 24 時間 (つまり、日常的な意味での昨日) |
| 412 | +を 1 日前として計算したいのなら、位置オプション \fB\-daystart\fP を \fB\-atime\fP |
| 413 | +の前に置けばよい。) |
| 414 | + |
| 415 | +.IP "\-cmin \fIn\fP" |
| 416 | +ファイルの最終ステータス変更日時が \fIn\fP 分前ならば真。 |
| 417 | + |
| 418 | +.IP "\-cnewer \fIfile\fP" |
| 419 | +ファイルの最終ステータス変更日時が、\fIfile\fP の内容更新日時よりも新しければ、真を返す。 |
| 420 | +引き数 \fIfile\fP がシンボリックリンクで、しかも \fB\-H\fP や \fB\-L\fP オプションが有効になっている場合は、 |
| 421 | +リンク先のファイルの内容更新日時が比較に使用されることになる。 |
| 422 | + |
| 423 | +.IP "\-ctime \fIn\fP" |
| 424 | +ファイルの最終ステータス変更日時が、基点となる時刻から計算して \fIn\fP 日前に当たれば、真を返す |
| 425 | +(訳注: 基点となる時刻は、デフォルトでは \fBfind\fP を実行している今現在である)。 |
| 426 | +何日前かを計算する際、基点となる時刻との時間差を 24 時間で割った結果を丸めるために、 |
| 427 | +ファイルのステータス変更日時が何日前と見なされることになるかについては、 |
| 428 | +\fB\-atime\fP の説明を参照していただきたい。 |
| 429 | +(訳注: 要するに、割り算の際に、小数点以下の端数を切り捨てるということ。 |
| 430 | +なお、デフォルトの動作のように、現在時刻から数えて 24 時間前から 48 時間前までを |
| 431 | +1 日前とするのではなく、今日の午前 0 時以前の 24 時間 (つまり、日常的な意味での昨日) |
| 432 | +を 1 日前として計算したいのなら、位置オプション \fB\-daystart\fP を \fB\-ctime\fP |
| 433 | +の前に置けばよい。) |
| 434 | + |
1147 | 435 | .IP \-empty |
1148 | 436 | ファイルが空で、通常のファイルかディレクトリならば真。 |
1149 | 437 | |
1150 | | -.\"O .IP \-executable |
1151 | | -.\"O Matches files which are executable and directories which are |
1152 | | -.\"O searchable (in a file name resolution sense). This takes into account |
1153 | | -.\"O access control lists and other permissions artefacts which the |
1154 | | -.\"O .B \-perm |
1155 | | -.\"O test ignores. This test makes use of the |
1156 | | -.\"O .BR access (2) |
1157 | | -.\"O system call, and so can be fooled by NFS servers which do UID |
1158 | | -.\"O mapping (or root-squashing), since many systems implement |
1159 | | -.\"O .BR access (2) |
1160 | | -.\"O in the client's kernel and so cannot make use of the UID mapping |
1161 | | -.\"O information held on the server. Because this test is based only on |
1162 | | -.\"O the result of the |
1163 | | -.\"O .BR access (2) |
1164 | | -.\"O system call, there is no guarantee that a file for which this test |
1165 | | -.\"O succeeds can actually be executed. |
1166 | | -.\"O |
1167 | 438 | .IP \-executable |
1168 | | -実行可能なファイルや (ファイル名解決の際に) 検索可能なディレクトリに |
1169 | | -マッチする。判別式 |
1170 | | -.B \-perm |
1171 | | -が ACL (アクセス・コントロール・リスト) などのパーミッション制御の |
1172 | | -仕組みを無視するのに対して、この判別式は ACL なども考慮に入れる。 |
1173 | | -この判別式は |
1174 | | -.BR access (2) |
1175 | | -システムコールを使用しているので、UID マッピング (または root-squashing) を |
1176 | | -行っている NFS サーバがあると、正確な結果を得られないことがある。 |
1177 | | -なぜなら、たいていのシステムは |
1178 | | -.BR access (2) |
1179 | | -をクライアントのカーネルで実装しており、それ故、サーバ側に保持されている |
1180 | | -UID マッピング情報を利用できないからだ。 |
1181 | | -この判別式はひとえに |
1182 | | -.BR access (2) |
1183 | | -システムコールの結果に基づいているので、この判別式が |
1184 | | -真を返したからと言って、そのファイルが実際に実行できるとはかぎらない。 |
1185 | | - |
1186 | | -.\"O .IP \-false |
1187 | | -.\"O Always false. |
1188 | | -.\"O |
| 439 | +実行可能なファイルや (ファイル名解決の見地から見て) 検索可能なディレクトリにマッチする。 |
| 440 | +検査 \fB\-perm\fP が ACL (アクセス・コントロール・リスト) |
| 441 | +などのパーミッション制御の仕組みを無視するのに対して、この検査は ACL |
| 442 | +なども考慮に入れる。この検査は \fBaccess\fP(2) システムコールを使用しているので、UID |
| 443 | +マッピング (または root\-squashing) を行っている |
| 444 | +NFS サーバがあると、正確な結果を得られないことがある。なぜなら、たいていのシステムでは |
| 445 | +\fBaccess\fP(2) をクライアントのカーネルで実装しており、それ故、サーバ側に保持されている |
| 446 | +UID マッピング情報を利用できないからだ。この検査はひとえに |
| 447 | +\fBaccess\fP(2) システムコールの結果に基づいているので、 |
| 448 | +この検査が真を返したからと言って、そのファイルが実際に実行できるとはかぎらない。 |
| 449 | + |
1189 | 450 | .IP \-false |
1190 | 451 | 常に偽を返す。 |
1191 | 452 | |
1192 | | -.\"O .IP "\-fstype \fItype\fR" |
1193 | | -.\"O File is on a filesystem of type \fItype\fR. The valid filesystem |
1194 | | -.\"O types vary among different versions of Unix; an incomplete list of |
1195 | | -.\"O filesystem types that are accepted on some version of Unix or another |
1196 | | -.\"O is: ufs, 4.2, 4.3, nfs, tmp, mfs, S51K, S52K. You can use |
1197 | | -.\"O .B \-printf |
1198 | | -.\"O with the %F directive to see the types of your filesystems. |
1199 | | -.\"O |
1200 | | -.IP "\-fstype \fItype\fR" |
1201 | | -ファイルが置かれているファイルシステムが \fItype\fR ならば、真を返す。 |
1202 | | -使用できるファイルシステムは、Unix の系統によって様々である。 |
1203 | | -Unix の系統次第では指定可能なファイルシステムを不完全ながら挙げると、 |
1204 | | -ufs, 4.2, 4.3, nfs, tmp, mfs, S51K, S52K などがある。 |
1205 | | -アクション |
1206 | | -.B \-printf |
1207 | | -で書式指定子 |
1208 | | -%F を使えば、使用中のファイルシステムのタイプが何かを知ることができる。 |
1209 | | - |
1210 | | -.\"O .IP "\-gid \fIn\fR" |
1211 | | -.\"O File's numeric group ID is \fIn\fR. |
1212 | | -.\"O |
1213 | | -.IP "\-gid \fIn\fR" |
1214 | | -ファイルのグループ ID 番号が \fIn\fR ならば真。 |
1215 | | - |
1216 | | -.\"O .IP "\-group \fIgname\fR" |
1217 | | -.\"O File belongs to group \fIgname\fR (numeric group ID allowed). |
1218 | | -.\"O |
1219 | | -.IP "\-group \fIgname\fR" |
1220 | | -ファイルの属するグループが \fIgname\fR ならば真 (グループ ID 番号で |
1221 | | -指定してもよい)。 |
1222 | | - |
1223 | | -.\"O .IP "\-ilname \fIpattern\fR" |
1224 | | -.\"O Like |
1225 | | -.\"O .BR \-lname , |
1226 | | -.\"O but the match is case insensitive. |
1227 | | -.\"O If the |
1228 | | -.\"O .B \-L |
1229 | | -.\"O option or the |
1230 | | -.\"O .B \-follow |
1231 | | -.\"O option is in effect, this test returns false unless the symbolic link |
1232 | | -.\"O is broken. |
1233 | | -.\"O |
1234 | | -.IP "\-ilname \fIpattern\fR" |
1235 | | -.B \-lname |
1236 | | -と同じだが、大文字小文字を区別しない。 |
1237 | | -.B \-L |
1238 | | -か |
1239 | | -.B \-follow |
1240 | | -オプションが有効な場合は、シンボリックリンクがリンク切れしている場合を除き、 |
1241 | | -この判別式は偽を返す。 |
1242 | | - |
1243 | | -.\"O .IP "\-iname \fIpattern\fR" |
1244 | | -.\"O Like |
1245 | | -.\"O .BR \-name , |
1246 | | -.\"O but the match is case insensitive. For example, the |
1247 | | -.\"O patterns `fo*' and `F??' match the file names `Foo', `FOO', `foo', |
1248 | | -.\"O `fOo', etc. In these patterns, unlike filename expansion by the |
1249 | | -.\"O shell, an initial '.' can be matched by `*'. That is, |
1250 | | -.\"O .B find \-name *bar |
1251 | | -.\"O will match the file `.foobar'. Please note that you should quote |
1252 | | -.\"O patterns as a matter of course, otherwise the shell will expand any |
1253 | | -.\"O wildcard characters in them. |
1254 | | -.\"O |
1255 | | -.IP "\-iname \fIpattern\fR" |
1256 | | -.B \-name |
1257 | | -と同じだが、大文字小文字を区別しない。 |
| 453 | +.IP "\-fstype \fItype\fP" |
| 454 | +ファイルが置かれているファイルシステムが \fItype\fP ならば、真を返す。 |
| 455 | +有効なファイルシステムは、Unix の系統によって様々である。 |
| 456 | +Unix の系統次第で指定可能なファイルシステムを不完全ながら挙げると、 |
| 457 | +ufs, 4.2, 4.3, nfs, tmp, mfs, S51K, S52K などがある。アクション \fB\-printf\fP |
| 458 | +で書式指定子 %F を使えば、現在使用中のファイルシステムのタイプが何かを知ることができる。 |
| 459 | + |
| 460 | +.IP "\-gid \fIn\fP" |
| 461 | +ファイルのグループ ID 番号が \fIn\fP ならば真。 |
| 462 | + |
| 463 | +.IP "\-group \fIgname\fP" |
| 464 | +ファイルの属するグループが \fIgname\fP ならば真 (グループ ID 番号で指定してもよい)。 |
| 465 | + |
| 466 | +.IP "\-ilname \fIpattern\fP" |
| 467 | +\fB\-lname\fP と同じだが、大文字小文字を区別しない。\fB\-L\fP や \fB\-follow\fP |
| 468 | +オプションが有効な場合は、シンボリックリンクがリンク切れしている場合を除き、この検査は偽を返す。 |
| 469 | + |
| 470 | + |
| 471 | +.IP "\-iname \fIpattern\fP" |
| 472 | +\fB\-name\fP と同じだが、大文字小文字を区別しない。 |
1258 | 473 | たとえば、パターン `fo*' や `F??' は、`Foo', `FOO', `foo', `fOo' |
1259 | | -といったファイル名とマッチする。シェルのファイル名展開と違い、 |
1260 | | -こうしたパターンにおいて '*' は、ファイル名の先頭にある '.' とも |
1261 | | -マッチする。すなわち、 |
1262 | | -.B find \-name *bar |
1263 | | -は、ファイル `.foobar' ともマッチすることになるわけだ。 |
1264 | | -当然ながら、パターンは引用符で囲むべきだということに気をつけて |
1265 | | -いただきたい。さもないと、パターン中にワイルドカード文字があれば、 |
1266 | | -シェルがそれを展開してしまうことになる。 |
1267 | | - |
1268 | | -.\"O .IP "\-inum \fIn\fR" |
1269 | | -.\"O File has inode number \fIn\fR. It is normally easier to use the |
1270 | | -.\"O .B \-samefile |
1271 | | -.\"O test instead. |
1272 | | -.\"O |
1273 | | -.IP "\-inum \fIn\fR" |
1274 | | -ファイルの inode 番号が \fIn\fR ならば真。たいていの場合、 |
1275 | | -この判別式より、 |
1276 | | -.B \-samefile |
1277 | | -を使った方が簡単である。 |
1278 | | - |
1279 | | -.\"O .IP "\-ipath \fIpattern\fR" |
1280 | | -.\"O Behaves in the same way as |
1281 | | -.\"O .BR \-iwholename . |
1282 | | -.\"O This option is deprecated, so please do not use it. |
1283 | | -.\"O |
1284 | | -.IP "\-ipath \fIpattern\fR" |
1285 | | -.B \-iwholename |
1286 | | -と同じように動作する。この判別式は非推奨である。使わないでいただきたい。 |
1287 | | - |
1288 | | -.\"O .IP "\-iregex \fIpattern\fR" |
1289 | | -.\"O Like |
1290 | | -.\"O .BR \-regex , |
1291 | | -.\"O but the match is case insensitive. |
1292 | | -.\"O |
1293 | | -.IP "\-iregex \fIpattern\fR" |
1294 | | -.B \-regex |
1295 | | -と同じだが、大文字小文字を区別しない。 |
1296 | | - |
1297 | | -.\"O .IP "\-iwholename \fIpattern\fR" |
1298 | | -.\"O Like |
1299 | | -.\"O .BR \-wholename , |
1300 | | -.\"O but the match is case insensitive. |
1301 | | -.\"O |
1302 | | -.IP "\-iwholename \fIpattern\fR" |
1303 | | -.B \-wholename |
1304 | | -と同じだが、大文字小文字を区別しない。 |
1305 | | - |
1306 | | -.\"O .IP "\-links \fIn\fR" |
1307 | | -.\"O File has \fIn\fR links. |
1308 | | -.\"O |
1309 | | -.IP "\-links \fIn\fR" |
1310 | | -ファイルのリンク数が \fIn\fR ならば真。 |
1311 | | - |
1312 | | -.\"O .IP "\-lname \fIpattern\fR" |
1313 | | -.\"O File is a symbolic link whose contents match shell pattern |
1314 | | -.\"O \fIpattern\fR. The metacharacters do not treat `/' or `.' specially. |
1315 | | -.\"O If the |
1316 | | -.\"O .B \-L |
1317 | | -.\"O option or the |
1318 | | -.\"O .B \-follow |
1319 | | -.\"O option is in effect, this test returns false unless the symbolic link |
1320 | | -.\"O is broken. |
1321 | | -.\"O |
1322 | | -.IP "\-lname \fIpattern\fR" |
1323 | | -ファイルがシンボリックリンクであり、リンク先として指定されているパスが |
1324 | | -シェルのパターン \fIpattern\fR にマッチすれば、真を返す。 |
1325 | | -メタ文字は、`/' や `.' を例外扱いしない。 |
1326 | | -.B \-L |
1327 | | -や |
1328 | | -.B \-follow |
1329 | | -オプションが有効な場合は、シンボリックリンクがリンク切れしている場合を除き、 |
1330 | | -この判別式は偽を返す。 |
1331 | | - |
1332 | | -.\"O .IP "\-mmin \fIn\fR" |
1333 | | -.\"O File's data was last modified \fIn\fR minutes ago. |
1334 | | -.\"O |
1335 | | -.IP "\-mmin \fIn\fR" |
1336 | | -ファイルの最終内容更新日時が \fIn\fR 分前であれば真。 |
1337 | | - |
1338 | | -.\"O .IP "\-mtime \fIn\fR" |
1339 | | -.\"O File's data was last modified \fIn\fR*24 hours ago. |
1340 | | -.\"O See the comments for |
1341 | | -.\"O .B \-atime |
1342 | | -.\"O to understand how rounding affects the interpretation of file |
1343 | | -.\"O modification times. |
1344 | | -.\"O |
1345 | | -.IP "\-mtime \fIn\fR" |
1346 | | -ファイルの最終内容更新日時が \fIn\fR 日前ならば、真を返す。 |
1347 | | -何日前かを計算する際に、現在時刻との時間差を 24 で割った余りを |
1348 | | -切り捨てることが、ファイルの内容更新日時の解釈にどんな影響を |
1349 | | -及ぼすかについては、 |
1350 | | -.B \-atime |
1351 | | -の説明を見てほしい。 |
1352 | | - |
1353 | | -.\"O .IP "\-name \fIpattern\fR" |
1354 | | -.\"O Base of file name (the path with the leading directories removed) |
1355 | | -.\"O matches shell pattern \fIpattern\fR. The metacharacters (`*', `?', |
1356 | | -.\"O and `[]') match a `.' at the start of the base name (this is a change |
1357 | | -.\"O in findutils-4.2.2; see section STANDARDS CONFORMANCE below). To ignore a |
1358 | | -.\"O directory and the files under it, use |
1359 | | -.\"O .BR \-prune ; |
1360 | | -.\"O see an example in the |
1361 | | -.\"O description of |
1362 | | -.\"O .BR \-path . |
1363 | | -.\"O Braces are not recognised as being |
1364 | | -.\"O special, despite the fact that some shells including Bash imbue braces |
1365 | | -.\"O with a special meaning in shell patterns. The filename matching is |
1366 | | -.\"O performed with the use of the |
1367 | | -.\"O .BR fnmatch (3) |
1368 | | -.\"O library function. Don't forget to enclose the pattern in quotes |
1369 | | -.\"O in order to protect it from expansion by the shell. |
1370 | | -.\"O |
1371 | | -.IP "\-name \fIpattern\fR" |
1372 | | -ファイルやディレクトリのベースネーム (パスから最後の要素だけを残して、 |
1373 | | -先行するディレクトリを取り去ったもの) が、シェルのパターン \fIpattern\fR に |
1374 | | -マッチすれば、真を返す。メタ文字 (`*', `?', `[]) は、 |
1375 | | -ベースネームの先頭にある `.' とマッチする (findutils-4.2.2 から |
1376 | | -このように変更になった。下記のセクション「標準への準拠」を参照)。 |
1377 | | -あるディレクトリとそれ以下にあるファイルをまとめて無視するには、 |
1378 | | -.B \-prune |
1379 | | -を使うとよい。一例が |
1380 | | -.B \-path |
1381 | | -の説明中にある。 |
1382 | | -中カッコ ('{}') は特殊文字として認識されない。この点、bash を含む |
1383 | | -一部のシェルで、シェル・パターン中の中カッコに特別な意味を付与しているのと |
1384 | | -異なっている。ファイル名のマッチングは、 |
1385 | | -.BR fnmatch (3) |
1386 | | -ライブラリ関数を用いて行われる。パターンを引用符で囲むのを |
1387 | | -忘れないように。シェルによって展開されてしまわないようにするためである。 |
1388 | | - |
1389 | | -.\"O .IP "\-newer \fIfile\fR" |
1390 | | -.\"O File was modified more recently than \fIfile\fR. If \fIfile\fR is a |
1391 | | -.\"O symbolic link and the |
1392 | | -.\"O .B \-H |
1393 | | -.\"O option or the |
1394 | | -.\"O .B \-L |
1395 | | -.\"O option is in effect, the |
1396 | | -.\"O modification time of the file it points to is always used. |
1397 | | -.\"O |
1398 | | -.IP "\-newer \fIfile\fR" |
1399 | | -ファイルが \fIfile\fR よりも最近に内容を更新されていれば、真を返す。 |
1400 | | -引き数 \fIfile\fR がシンボリックリンクで、しかも |
1401 | | -.B \-H |
1402 | | -や |
1403 | | -.B \-L |
1404 | | -オプションが有効になっている場合は、 |
1405 | | -リンク先のファイルの内容更新日時が比較に使用されることになる。 |
| 474 | +といったファイル名とマッチする。パターン `*foo*' は、`.foobar' |
| 475 | +というファイルともマッチすることになる。 |
| 476 | + |
| 477 | +.IP "\-inum \fIn\fP" |
| 478 | +ファイルの inode 番号が \fIn\fP ならば真。 |
| 479 | +たいていの場合、この検査より、\fB\-samefile\fP を使った方が簡単である。 |
| 480 | + |
| 481 | +.IP "\-ipath \fIpattern\fP" |
| 482 | +\fB\-path\fP と同じだが、大文字小文字を区別しない。 |
| 483 | + |
| 484 | +.IP "\-iregex \fIpattern\fP" |
| 485 | +\fB\-regex\fP と同じだが、大文字小文字を区別しない。 |
| 486 | + |
| 487 | +.IP "\-iwholename \fIpattern\fP" |
| 488 | +\fB\-ipath\fP 参照。この別名は移植性で \fB\-ipath\fP に劣る。 |
| 489 | + |
| 490 | +.IP "\-links \fIn\fP" |
| 491 | +ファイルのハードリンク数が \fIn\fP ならば真。 |
| 492 | + |
| 493 | +.IP "\-lname \fIpattern\fP" |
| 494 | +ファイルがシンボリックリンクであり、リンク先として指定されているパスがシェルのパターン |
| 495 | +\fIpattern\fP にマッチすれば、真を返す。メタ文字は、`/' や `.' を例外扱いしない。 |
| 496 | +\fB\-L\fP や \fB\-follow\fP オプションが有効な場合は、シンボリックリンクがリンク切れしている場合を除き、この検査は偽を返す。 |
| 497 | + |
| 498 | +.IP "\-mmin \fIn\fP" |
| 499 | +ファイルの最終内容更新日時が \fIn\fP 分前であれば真。 |
| 500 | + |
| 501 | +.IP "\-mtime \fIn\fP" |
| 502 | +ファイルの最終内容更新日時が、基点となる時刻から計算して \fIn\fP 日前に当たれば、真を返す |
| 503 | +(訳注: 基点となる時刻は、デフォルトでは \fBfind\fP を実行している今現在である)。 |
| 504 | +何日前かを計算する際、基点となる時刻との時間差を 24 時間で割った結果を丸めるために、 |
| 505 | +ファイルの内容更新日時が何日前と見なされることになるかについては、 |
| 506 | +\fB\-atime\fP の説明を参照していただきたい。 |
| 507 | +(訳注: 要するに、割り算の際に、小数点以下の端数を切り捨てるということ。 |
| 508 | +なお、デフォルトの動作のように、現在時刻から数えて 24 時間前から 48 時間前までを |
| 509 | +1 日前とするのではなく、今日の午前 0 時以前の 24 時間 (つまり、日常的な意味での昨日) |
| 510 | +を 1 日前として計算したいのなら、位置オプション \fB\-daystart\fP を \fB\-mtime\fP |
| 511 | +の前に置けばよい。) |
| 512 | + |
| 513 | +.IP "\-name \fIpattern\fP" |
| 514 | +ファイルやディレクトリのベースネーム (パスから最後の要素だけを残して、先行するディレクトリを取り去ったもの) |
| 515 | +が、シェルのパターン \fIpattern\fP にマッチすれば、真を返す。検査 \fB\-name\fP |
| 516 | +でマッチするかどうかを調べられるファイル名は、先行するディレクトリが除去されているので、スラッシュが含まれることがない。従って、`\-name a/b' |
| 517 | +は何にもマッチしないことになる (\fB\-name\fP ではなく、多分 \fB\-path\fP |
| 518 | +を使う必要があるだろう)。そんなことをしようとすると、環境変数 POSIXLY_CORRECT |
| 519 | +が設定されていない場合は、警告メッセージが出る。 |
| 520 | +メタ文字 (`*', `?', `[]') は、ベースネームの先頭にある `.' とマッチする |
| 521 | +(findutils\-4.2.2 からこのように変更になった。下記のセクション「規格への準拠」を参照)。 |
| 522 | +あるディレクトリとそれ以下にあるファイルをまとめて無視するには、\fB\-prune\fP を使うとよい。 |
| 523 | +一例が \fB\-path\fP の説明中にある。中カッコ ('{}') は特殊文字として認識されない。 |
| 524 | +この点、bash を含む一部のシェルで、シェル・パターン中の中カッコに特別な意味を付与しているのと異なっている。 |
| 525 | +ファイル名のマッチングは、\fBfnmatch\fP(3) ライブラリ関数を用いて行われる。 |
| 526 | +パターンを引用符で囲むのを忘れないように。シェルによって展開されてしまわないようにするためである。 |
| 527 | + |
| 528 | +.IP "\-newer \fIfile\fP" |
| 529 | +ファイルが \fIfile\fP よりも最近に内容を更新されていれば、真を返す。 |
| 530 | +引き数 \fIfile\fP がシンボリックリンクで、しかも \fB\-H\fP や \fB\-L\fP |
| 531 | +オプションが有効になっている場合は、リンク先のファイルの内容更新日時が比較に使用されることになる。 |
| 532 | + |
| 533 | +.IP "\-newerXY \fIreference\fP" |
| 534 | +検査対象ファイルのタイムスタンプの \fIX\fP 日時が、リフェレンスファイル |
| 535 | +\fIreference\fP のタイムスタンプの \fIY\fP 日時より新しければ、真を返す。 |
| 536 | +\fIX\fP と \fIY\fP の位置に来る文字は、以下のどの文字でもよい。 |
1406 | 537 | |
1407 | | -.\"O .IP "\-newerXY \fIreference\fR" |
1408 | | -.\"O Compares the timestamp of the current file with \fIreference\fR. |
1409 | | -.\"O The |
1410 | | -.\"O .I reference |
1411 | | -.\"O argument is normally the name of a file (and one of its timestamps is |
1412 | | -.\"O used for the comparison) but it may also be a string describing an |
1413 | | -.\"O absolute time. |
1414 | | -.\"O .I X |
1415 | | -.\"O and |
1416 | | -.\"O .I Y |
1417 | | -.\"O are placeholders for other letters, and these letters select which |
1418 | | -.\"O time belonging to |
1419 | | -.\"O how |
1420 | | -.\"O .I reference |
1421 | | -.\"O is used for the comparison. |
1422 | | -.IP "\-newerXY \fIreference\fR" |
1423 | | -目下検査の対象になっているファイルのタイムスタンプを \fIreference\fR と |
1424 | | -比較する。引き数 |
1425 | | -.I reference |
1426 | | -は、たいていの場合ファイル名であるが (そして、そのタイムスタンプの一つが |
1427 | | -比較に使用されるが)、日時を直接表す文字列でも構わない。 |
1428 | | -.I X |
1429 | | -と |
1430 | | -.I Y |
1431 | | -は仮の表現であって、実際には以下に述べるような別の文字が来る。 |
1432 | | -そうした文字が、検査の対象になっているファイルとリファレンスそれぞれの、 |
1433 | | -どの日時を比較に使用するかを決めるのである (訳注: 前者を |
1434 | | -.I X |
1435 | | -で、 |
1436 | | -後者を |
1437 | | -.I Y |
1438 | | -で指定する)。 |
1439 | | -.\"O .TS |
1440 | | -.\"O ll |
1441 | | -.\"O ll |
1442 | | -.\"O ll |
1443 | | -.\"O ll |
1444 | | -.\"O llw(2i). |
1445 | | -.\"O a The access time of the file \fIreference\fR |
1446 | | -.\"O B The birth time of the file \fIreference\fR |
1447 | | -.\"O c The inode status change time of \fIreference\fR |
1448 | | -.\"O m The modification time of the file \fIreference\fR |
1449 | | -.\"O t \fIreference\fR is interpreted directly as a time |
1450 | | -.\"O .TE |
1451 | | -.\"O |
1452 | 538 | .TS |
1453 | 539 | ll |
1454 | 540 | ll |
| | @@ -1459,2766 +545,1008 @@ a ファイルのアクセス日時 |
1459 | 545 | B ファイルの作成日時 |
1460 | 546 | c inode のステータスが変更された日時 |
1461 | 547 | m ファイルの内容が更新された日時 |
1462 | | -t \fIreference\fR が日時の直接表現として解釈される |
| 548 | +t \fIreference\fP が日時の直接表現として解釈される |
1463 | 549 | .TE |
1464 | 550 | |
1465 | | -.\"O Some combinations are invalid; for example, it is invalid for |
1466 | | -.\"O .I X |
1467 | | -.\"O to be |
1468 | | -.\"O .IR t . |
1469 | | -組み合わせによっては、無効なものもある。たとえば、 |
1470 | | -.I X |
1471 | | -に |
1472 | | -.I t |
1473 | | -を指定しても無効である。 |
1474 | | -.\"O Some combinations are not implemented on all systems; for example |
1475 | | -.\"O .I B |
1476 | | -.\"O is not supported on all systems. If an invalid or unsupported |
1477 | | -.\"O combination of |
1478 | | -.\"O .I XY |
1479 | | -.\"O is specified, a fatal error results. Time specifications are |
1480 | | -.\"O interpreted as for the argument to the |
1481 | | -.\"O .B \-d |
1482 | | -.\"O option of GNU |
1483 | | -.\"O .BR date . |
1484 | | -.\"O If you try to use the birth time of a reference file, and the birth |
1485 | | -.\"O time cannot be determined, a fatal error message results. If you |
1486 | | -.\"O specify a test which refers to the birth time of files being examined, |
1487 | | -.\"O this test will fail for any files where the birth time is unknown. |
1488 | | -.\"O |
1489 | | -組み合わせの中には、すべてのシステムで実装されているとはかぎらない |
1490 | | -ものもある。たとえば、 |
1491 | | -.I B |
1492 | | -はすべてのシステムでサポートされているわけではない。 |
1493 | | -.I XY |
1494 | | -の無効な組み合わせやサポートされていない組み合わせを指定すると、 |
1495 | | -致命的エラーが起きる。日時を直接指定すると、それは GNU |
1496 | | -.B date |
1497 | | -の |
1498 | | -.B \-d |
1499 | | -オプションに対する引き数と同様に解釈される。 |
1500 | | -リファレンスファイルの作成日時を使用しようとして、作成日時が |
1501 | | -特定できない場合は、致命的エラーのメッセージが表示される。 |
1502 | | -また、検査対象になるファイルの作成日時を参照する判別式を指定した場合、 |
1503 | | -作成日時がわからない環境では、そのテストはどのファイルに対しても |
1504 | | -失敗することになる。 |
1505 | | - |
1506 | | -.\"O .IP \-nogroup |
1507 | | -.\"O No group corresponds to file's numeric group ID. |
1508 | | -.\"O |
| 551 | +組み合わせによっては、無効なものもある。たとえば、\fIX\fP に \fIt\fP を指定しても無効である。 |
| 552 | +組み合わせの中には、すべてのシステムで実装されているとはかぎらないものもある。 |
| 553 | +たとえば、\fIB\fP はすべてのシステムでサポートされているわけではない。 |
| 554 | +\fIXY\fP の無効な組み合わせやサポートされていない組み合わせを指定すると、致命的エラーが生じる。 |
| 555 | +日時を直接指定すると、それは GNU \fBdate\fP の \fB\-d\fP オプションに対する引き数と同じように解釈される。 |
| 556 | +リファレンスファイルの作成日時を使用しようとした場合に、作成日時が特定できないと、致命的エラーのメッセージが出力される。 |
| 557 | +また、検査対象ファイルの作成日時を参照する検査を指定した場合に、 |
| 558 | +作成日時がわからない環境では、その検査はいかなるファイルに対しても失敗することになる |
| 559 | +(訳注: この場合、失敗するというのは、検査が偽になることではなく、エラーになることのようだ。ご自分の環境で確かめていただきたい)。 |
| 560 | + |
1509 | 561 | .IP \-nogroup |
1510 | | -ファイルのグループ ID 番号に対応するグループが存在しなければ真。 |
| 562 | +ファイルのグループ ID 番号に対応するグループが、システムに存在しない場合に、真を返す。 |
1511 | 563 | |
1512 | | -.\"O .IP \-nouser |
1513 | | -.\"O No user corresponds to file's numeric user ID. |
1514 | | -.\"O |
1515 | 564 | .IP \-nouser |
1516 | | -ファイルのユーザ ID 番号に対応するユーザが存在しなければ真。 |
1517 | | - |
1518 | | -.\"O .IP "\-path \fIpattern\fR" |
1519 | | -.\"O File name matches shell pattern \fIpattern\fR. The metacharacters do |
1520 | | -.\"O not treat `/' or `.' specially; so, for example, |
1521 | | -.IP "\-path \fIpattern\fR" |
1522 | | -ファイル名がシェルのパターン \fIpattern\fR にマッチすれば真。 |
1523 | | -メタ文字は `/' や `.' を例外扱いしない。従って、たとえば、 |
1524 | | -.\"O .br |
1525 | | -.\"O .in +1i |
1526 | | -.\"O find . \-path "./sr*sc" |
1527 | | -.\"O .br |
1528 | | -.\"O .in -1i |
1529 | | -.\"O will print an entry for a directory called `./src/misc' (if one |
1530 | | -.\"O exists). To ignore a whole directory tree, use |
1531 | | -.\"O .B \-prune |
1532 | | -.\"O rather than |
1533 | | -.\"O checking every file in the tree. For example, to skip the |
1534 | | -.\"O directory `src/emacs' and all files and directories under it, and |
1535 | | -.\"O print the names of the other files found, do something like this: |
| 565 | +ファイルのユーザ ID 番号に対応するユーザが、システムに存在しない場合に、真を返す。 |
| 566 | + |
| 567 | +.IP "\-path \fIpattern\fP" |
| 568 | +ファイル名がシェルのパターン \fIpattern\fP にマッチすれば、真を返す。 |
| 569 | +メタ文字は、`/' や `.' を例外扱いしない。従って、たとえば、 |
1536 | 570 | .br |
1537 | 571 | .in +1i |
1538 | 572 | find . \-path "./sr*sc" |
1539 | 573 | .br |
1540 | 574 | .in -1i |
1541 | | -は、`./src/misc' と言うディレクトリを (存在していれば) 表示する。 |
1542 | | -あるディレクトリ以下をすべて無視するには、そこに存在するファイルを |
1543 | | -一つ一つ抑止するよりも、 |
1544 | | -.B \-prune |
1545 | | -を使用した方がよい。たとえば、 `src/emacs' と、その下にあるファイルや |
1546 | | -ディレクトリのすべてをスキップし、それ以外のファイルがあったら、 |
1547 | | -その名前を表示するとしよう。そのためには、こんな風にする。 |
1548 | | -.\"O .br |
1549 | | -.\"O .in +1i |
1550 | | -.\"O find . \-path ./src/emacs \-prune \-o \-print |
1551 | | -.\"O .br |
1552 | | -.\"O .in -1i |
1553 | | -.\"O Note that the pattern match test applies to the whole file name, |
1554 | | -.\"O starting from one of the start points named on the command line. It |
1555 | | -.\"O would only make sense to use an absolute path name here if the |
1556 | | -.\"O relevant start point is also an absolute path. This means that this |
1557 | | -.\"O command will never match anything: |
| 575 | +は、`./src/misc' というディレクトリを (存在していれば) 表示することになる。 |
| 576 | +あるディレクトリ以下をすべて無視するには、そこに存在するファイルを一つ一つ抑止するよりも、\fB\-prune\fP |
| 577 | +を使用した方がよい。たとえば、ディレクトリ `src/emacs' |
| 578 | +と、その下にあるファイルやディレクトリのすべてをスキップし、それ以外のファイルが見つかったら、その名前を表示するとしよう。そのためには、こんな風にする。 |
1558 | 579 | .br |
1559 | 580 | .in +1i |
1560 | 581 | find . \-path ./src/emacs \-prune \-o \-print |
1561 | 582 | .br |
1562 | 583 | .in -1i |
1563 | | -パターンマッチのテストは、パスを含むファイル名の全体に対して行われるが、 |
1564 | | -そうしたパス付きのファイル名は、コマンドラインで指定した探索の始点の一つから |
1565 | | -始まっていることに注意してほしい。だから、 |
1566 | | -.B \-path |
1567 | | -の引き数に絶対パス名を使用することに意味があるのは、関連する探索の |
1568 | | -始点がこちらも絶対パスであるときだけだろう。従って、次のコマンドは |
1569 | | -何にもマッチしないことになる。 |
1570 | | -.\"O .br |
1571 | | -.\"O .in +1i |
1572 | | -.\"O find bar \-path /foo/bar/myfile \-print |
1573 | | -.\"O .br |
1574 | | -.\"O .in -1i |
1575 | | -.\"O The predicate |
1576 | | -.\"O .B \-path |
1577 | | -.\"O is also supported by HP-UX |
1578 | | -.\"O .B find |
1579 | | -.\"O and will be in a forthcoming version of the POSIX standard. |
1580 | | -.\"O |
| 584 | +パターンマッチの検査は、パスを含むファイル名の全体に対して行われるが、 |
| 585 | +そうしたファイル名は、コマンドラインで指定した探索開始点の一つから始まっていることに注意してしていただきたい。 |
| 586 | +だから、\fB\-path\fP の引き数に絶対パス名を使用することに意味があるのは、 |
| 587 | +関連する探索開始点がこちらも絶対パスであるときだけだろう。 |
| 588 | +従って、次のコマンドは 何にもマッチしないことになる。 |
1581 | 589 | .br |
1582 | 590 | .in +1i |
1583 | 591 | find bar \-path /foo/bar/myfile \-print |
1584 | 592 | .br |
1585 | 593 | .in -1i |
1586 | | -述語 |
1587 | | -.B \-path |
1588 | | -は、HP-UX の |
1589 | | -.B find |
1590 | | -でもサポートされている。 |
1591 | | -POSIX 標準の次期バージョンでも採用されることになるだろう。 |
1592 | | - |
1593 | | -.\"O .IP "\-perm \fImode\fR" |
1594 | | -.\"O File's permission bits are exactly \fImode\fR (octal or symbolic). |
1595 | | -.\"O Since an exact match is required, if you want to use this form for |
1596 | | -.\"O symbolic modes, you may have to specify a rather complex mode string. |
1597 | | -.\"O For example |
1598 | | -.\"O .B \-perm g=w |
1599 | | -.\"O will only match files which have mode 0020 |
1600 | | -.\"O (that is, ones for which group write permission is the only permission |
1601 | | -.\"O set). It is more likely that you will want to use the `/' or `-' |
1602 | | -.\"O forms, for example |
1603 | | -.\"O .BR "\-perm \-g=w" , |
1604 | | -.\"O which matches any file with group write permission. See the |
1605 | | -.\"O .B EXAMPLES |
1606 | | -.\"O section for some illustrative examples. |
1607 | | -.\"O |
1608 | | -.IP "\-perm \fImode\fR" |
1609 | | -ファイルの許可属性が \fImode\fR (8 進数表現でもシンボル表現でもよい) |
1610 | | -とまったく同じなら、真を返す。 |
1611 | | -\fImode\fR 指定のこの形式では、許可属性がぴったり一致することを |
1612 | | -要求しているので、シンボルによる表現でこの形式を使おうとすると、 |
1613 | | -かなり複雑なモード文字列を指定しなければならないかもしれない。たとえば |
1614 | | -.B \-perm g=w |
1615 | | -は、許可属性が 0020 のファイルにしかマッチしないことになる |
1616 | | -(すなわち、許可属性のうち、グループの書き込み許可のみが立っている |
1617 | | -ファイルだ)。そんなわけで、\fImode\fR の前に `/' や `-' を付ける形式を |
1618 | | -使いたくなる場合の方が、ずっと多そうである。たとえば、 |
1619 | | -.BR "\-perm \-g=w" |
1620 | | -なら、グループが書き込み許可を持っているいかなるファイルにも |
1621 | | -マッチするわけだ。具体例については「用例」セクションを見てほしい。 |
1622 | | - |
1623 | | -.\"O .IP "\-perm \-\fImode\fR" |
1624 | | -.\"O All of the permission bits \fImode\fR are set for the file. |
1625 | | -.\"O Symbolic modes are accepted in this form, and this is usually the way |
1626 | | -.\"O in which would want to use them. You must specify `u', `g' or `o' if |
1627 | | -.\"O you use a symbolic mode. See the |
1628 | | -.\"O .B EXAMPLES |
1629 | | -.\"O section for some illustrative examples. |
1630 | | -.\"O |
1631 | | -.IP "\-perm \-\fImode\fR" |
1632 | | -\fImode\fR で指定した許可属性ビットのすべてが、ファイルでも立っていれば、 |
1633 | | -真を返す。\fImode\fR 指定のこの形式でも、シンボルによる許可属性表現が |
1634 | | -使用できる。と言うより、この形式ではたいていの場合、シンボルによる表現を |
1635 | | -使いたくなるだろう。 |
1636 | | -シンボルによる表現を使用する場合は、`u' や `g' や `o' を |
1637 | | -きちんと指定しなければならない。具体例については「用例」セクションを |
1638 | | -見てほしい。 |
1639 | | - |
1640 | | -.\"O .IP "\-perm /\fImode\fR" |
1641 | | -.\"O Any of the permission bits \fImode\fR are set for the file. Symbolic |
1642 | | -.\"O modes are accepted in this form. You must specify `u', `g' or `o' if |
1643 | | -.\"O you use a symbolic mode. See the |
1644 | | -.\"O .B EXAMPLES |
1645 | | -.\"O section for some illustrative examples. If no permission bits in |
1646 | | -.\"O .I mode |
1647 | | -.\"O are set, this test matches any file (the idea here is to be consistent |
1648 | | -.\"O with the behaviour of |
1649 | | -.\"O .B \-perm |
1650 | | -.\"O .BR \-000 ). |
1651 | | -.\"O |
1652 | | -.IP "\-perm /\fImode\fR" |
1653 | | -\fImode\fR で指定した許可属性ビットのどれかが、ファイルでも立っていれば、 |
1654 | | -真を返す。\fImode\fR 指定のこの形式でも、シンボルによる許可属性表現が |
1655 | | -使用できる。シンボルによる表現を使用する場合は、`u' や `g' や `o' を |
1656 | | -きちんと指定しなければならない。具体例については「用例」セクションを |
1657 | | -見てほしい。 |
1658 | | -.I mode |
1659 | | -で許可属性ビットが一つも立っていない場合、この判別式は |
1660 | | -いかなるファイルにもマッチする (すなわち、 |
1661 | | -.B \-perm |
1662 | | -.B \-000 |
1663 | | -の動作と同じだということだ)。 |
1664 | | - |
1665 | | -.\"O .IP "\-perm +\fImode\fR" |
1666 | | -.\"O Deprecated, old way of searching for files with any of the permission |
1667 | | -.\"O bits in \fImode\fR set. You should use |
1668 | | -.\"O .B \-perm \fI/mode\fR |
1669 | | -.\"O instead. Trying to use the `+' syntax with symbolic modes will yield |
1670 | | -.\"O surprising results. For example, `+u+x' is a valid symbolic mode |
1671 | | -.\"O (equivalent to +u,+x, i.e. 0111) and will therefore not be evaluated |
1672 | | -.\"O as |
1673 | | -.\"O .B \-perm +\fImode\fR |
1674 | | -.\"O but instead as the exact mode specifier |
1675 | | -.\"O .B \-perm \fImode\fR |
1676 | | -.\"O and so it matches files with exact permissions 0111 instead of files with any |
1677 | | -.\"O execute bit set. If you found this paragraph confusing, you're not |
1678 | | -.\"O alone - just use |
1679 | | -.\"O .B \-perm /\fImode\fR. |
1680 | | -.\"O This form of the |
1681 | | -.\"O .B \-perm |
1682 | | -.\"O test is deprecated because the POSIX specification requires the |
1683 | | -.\"O interpretation of a leading `+' as being part of a symbolic mode, and |
1684 | | -.\"O so we switched to using `/' instead. |
1685 | | -.\"O |
1686 | | -.IP "\-perm +\fImode\fR" |
1687 | | -非推奨な形式。\fImode\fR で指定した許可属性ビットのどれかが立っている |
1688 | | -ファイルを捜す古い方法である。代わりに |
1689 | | -.B \-perm \fI/mode\fR |
1690 | | -を使用した方がよい。`+' を付けて \fImode\fR を指定するこの形式で |
1691 | | -シンボルによる表現を使おうとすると、思いがけない結果を生むことがある。 |
1692 | | -たとえば、 `+u+x' はそれ自体有効なシンボル表現である ('+u,+x' と |
1693 | | -同じであり、0111 を意味する)。そのため、 |
1694 | | -.B \-perm +u+x |
1695 | | -は、 |
1696 | | -.B \-perm +\fImode\fR |
1697 | | -として評価されず、ぴったり一致する許可属性を指定するときの |
1698 | | -.B \-perm \fImode\fR |
1699 | | -として評価されてしまうのだ。その結果、実行ビットが少なくともどれか一つ |
1700 | | -立っているファイルではなく、許可属性がぴったり 0111 のファイルに |
1701 | | -マッチすることになる。もし、この項の説明がわかりにくかったとしても、 |
1702 | | -あなた一人がわからないのではない。とりあえず、 |
1703 | | -.B \-perm /\fImode\fR |
1704 | | -を使っておいていただきたい。判別式 |
1705 | | -.B \-perm |
1706 | | -のこの形式が非推奨なのは、シンボルによる許可属性に先行する `+' は、 |
1707 | | -シンボル表現の一部として解釈するように POSIX の規定で要求されて |
1708 | | -いるからであり、それ故、我々は '+' に代えて、'/' を使うようにしたのである。 |
1709 | | - |
1710 | | -.\"O .IP \-readable |
1711 | | -.\"O Matches files which are readable. This takes into account access |
1712 | | -.\"O control lists and other permissions artefacts which the |
1713 | | -.\"O .B \-perm |
1714 | | -.\"O test ignores. This test makes use of the |
1715 | | -.\"O .BR access (2) |
1716 | | -.\"O system call, and so can be fooled by NFS servers which do UID |
1717 | | -.\"O mapping (or root-squashing), since many systems implement |
1718 | | -.\"O .BR access (2) |
1719 | | -.\"O in the client's kernel and so cannot make use of the UID mapping |
1720 | | -.\"O information held on the server. |
1721 | | -.\"O |
| 594 | +\fBfind\fP は、\fB\-path\fP の引き数を、目下検査してるファイルのディレクトリ名とベースネームを連結したものと比較する。 |
| 595 | +その連結したものの末尾がスラッシュになることは絶対にないので、スラッシュで終わる |
| 596 | +\fB\-path\fP の引き数は、何にもマッチしないことになる |
| 597 | +(ただし、コマンドラインで指定された探索開始点となら、場合によってはマッチするかもしれないが)。 |
| 598 | +\fB\-path\fP という述語は、HP\-UX の \fBfind\fP でもサポートされており、 |
| 599 | +POSIX 規格の次期バージョンでも採用されることになるだろう |
| 600 | +(訳注: 実際に POSIX 2008 で採用されている)。 |
| 601 | + |
| 602 | +.IP "\-perm \fImode\fP" |
| 603 | +ファイルの許可属性が \fImode\fP (8 進数表現でもシンボル表現でもよい) とまったく同じなら、真を返す。 |
| 604 | +\fImode\fP 指定のこの形式では、許可属性がぴったり一致することを要求することになるので、 |
| 605 | +シンボルによる表現でこの形式を使おうとすると、かなり複雑なモード文字列を指定しなければならないかもしれない。 |
| 606 | +たとえば `\-perm g=w' は、許可属性が 0020 のファイルにしかマッチしない |
| 607 | +(すなわち、許可属性のうち、グループの書き込み許可のみが立っているファイルだ)。 |
| 608 | +従って、\fImode\fP の前に `/' や `\-' を付ける形式を使いたくなることの方が、多分多いだろう。 |
| 609 | +たとえば、`\-perm \-g=w' とすれば、グループの書き込み許可があるファイルなら、どんなファイルにもマッチすることになる。 |
| 610 | +具体例については「用例」セクションをご覧いただきたい。 |
| 611 | + |
| 612 | +.IP "\-perm \-\fImode\fP" |
| 613 | +\fImode\fP で指定した許可属性ビットのすべてが、ファイルでも立っていれば、真を返す。 |
| 614 | +\fImode\fP 指定のこの形式でも、シンボルによる許可属性表現が使用できる。 |
| 615 | +そこで、この形式ではシンボルによる表現を使いたくなることが多いだろう。 |
| 616 | +シンボルによる表現を使用する場合は、`u' や `g' や `o' を きちんと指定しなければならない。 |
| 617 | +具体例については「用例」セクションをご覧いただきたい。 |
| 618 | + |
| 619 | +.IP "\-perm /\fImode\fP" |
| 620 | +\fImode\fP で指定した許可属性ビットのどれかが、ファイルでも立っていれば、真を返す。 |
| 621 | +\fImode\fP 指定のこの形式でも、シンボルによる許可属性表現が使用できる。 |
| 622 | +シンボルによる表現を使用する場合は、`u' や `g' や `o' をきちんと指定しなければならない。 |
| 623 | +具体例については「用例」セクションをご覧いただきたい。なお、\fImode\fP |
| 624 | +で許可属性ビットが一つも立っていない場合、この検査はいかなるファイルにもマッチすることになる |
| 625 | +(これは、\fB\-perm\fP \fB\-000\fP と動作に一貫性を持たせるための変更である。 |
| 626 | +(訳注: \fB\-perm\fP \-\fImode\fP と \fB\-perm\fP /\fImode\fP |
| 627 | +のどちらの指定法においても、0 は何であってもよいを意味するようにしたということ))。 |
| 628 | + |
| 629 | +.IP "\-perm +\fImode\fP" |
| 630 | +この形式は、今ではサポートされていない (2005 年以来、非推奨だった)。 |
| 631 | +代わりに \fB\-perm /\fP\fImode\fP を使用すること。 |
| 632 | + |
1722 | 633 | .IP \-readable |
1723 | | -読み込み可能なファイルにマッチする。判別式 |
1724 | | -.B \-perm |
1725 | | -が ACL (アクセス・コントロール・リスト) などのパーミッション制御の |
1726 | | -仕組みを無視するのに対して、この判別式は ACL なども考慮に入れる。 |
1727 | | -この判別式は |
1728 | | -.BR access (2) |
1729 | | -システムコールを使用しているので、UID マッピング (または |
1730 | | -root-squashing) を行っている NFS サーバがあると、正確な結果を |
1731 | | -得られないことがある。なぜなら、たいていのシステムは |
1732 | | -.BR access (2) |
1733 | | -をクライアントのカーネルで実装しており、それ故、サーバ側に保持されている |
| 634 | +読み込み可能なファイルにマッチする。検査 \fB\-perm\fP が |
| 635 | +ACL (アクセス・コントロール・リスト) などのパーミッション制御の仕組みを無視するのに対して、この検査は ACL なども考慮に入れる。 |
| 636 | +この検査は \fBaccess\fP(2) システムコールを使用しているので、UID マッピング (または root\-squashing) |
| 637 | +を行っている NFS サーバがあると、正確な結果を得られないことがある。なぜなら、たいていのシステムでは |
| 638 | +\fBaccess\fP(2) をクライアントのカーネルで実装しており、それ故、サーバ側に保持されている |
1734 | 639 | UID マッピング情報を利用できないからである。 |
1735 | 640 | |
1736 | | -.\"O .IP "\-regex \fIpattern\fR" |
1737 | | -.\"O File name matches regular expression \fIpattern\fR. This is a match |
1738 | | -.\"O on the whole path, not a search. For example, to match a file named |
1739 | | -.\"O `./fubar3', you can use the regular expression `.*bar.' or `.*b.*3', |
1740 | | -.\"O but not `f.*r3'. The regular expressions understood by |
1741 | | -.\"O .B find |
1742 | | -.\"O are by default Emacs Regular Expressions, but this can be |
1743 | | -.\"O changed with the |
1744 | | -.\"O .B \-regextype |
1745 | | -.\"O option. |
1746 | | -.\"O |
1747 | | -.IP "\-regex \fIpattern\fR" |
1748 | | -ファイル名が正規表現 \fIpattern\fR にマッチすれば、真を返す。 |
1749 | | -これはパスを含むファイル名全体に対するマッチであって、部分的な一致ではない。 |
| 641 | +.IP "\-regex \fIpattern\fP" |
| 642 | +ファイル名が正規表現 \fIpattern\fP にマッチすれば、真を返す。 |
| 643 | +これはパスを含むファイル名全体に対するマッチであって、ベースネームの検索ではない。 |
1750 | 644 | だから、たとえば、`./fubar3' という名前のファイルにマッチさせるために、 |
1751 | | -正規表現 `.*bar.' や `.*b.*3' は使用できるが、`f.*r3' は使用できないわけだ。 |
1752 | | -.B find |
1753 | | -が理解する正規表現は、デフォルトでは Emacs の正規表現だが、これは |
1754 | | -.B \-regextype |
1755 | | -オプションで変更することができる。 |
1756 | | - |
1757 | | -.\"O .IP "\-samefile \fIname\fR" |
1758 | | -.\"O File refers to the same inode as \fIname\fR. When |
1759 | | -.\"O .B \-L |
1760 | | -.\"O is in effect, this can include symbolic links. |
1761 | | -.\"O |
1762 | | -.IP "\-samefile \fIname\fR" |
1763 | | -ファイルが \fIname\fR と同じ inode を参照していれば、真を返す。 |
1764 | | -.B \-L |
1765 | | -が有効な場合、シンボリックリンクも真を返す。 |
1766 | | - |
1767 | | -.\"O .IP "\-size \fIn\fR[cwbkMG]" |
1768 | | -.\"O File uses \fIn\fP units of space. The following suffixes |
1769 | | -.\"O can be used: |
1770 | | -.\"O .RS |
1771 | | -.\"O .IP `b' |
1772 | | -.\"O for 512-byte blocks (this is the default if no suffix is used) |
1773 | | -.\"O .IP `c' |
1774 | | -.\"O for bytes |
1775 | | -.\"O .IP `w' |
1776 | | -.\"O for two-byte words |
1777 | | -.\"O .IP `k' |
1778 | | -.\"O for Kilobytes (units of 1024 bytes) |
1779 | | -.\"O .IP `M' |
1780 | | -.\"O for Megabytes (units of 1048576 bytes) |
1781 | | -.\"O .IP `G' |
1782 | | -.\"O for Gigabytes (units of 1073741824 bytes) |
1783 | | -.\"O .RE |
1784 | | -.IP "\-size \fIn\fR[cwbkMG]" |
1785 | | -ファイルが \fIn\fP 単位分の領域を使用していれば、真を返す。 |
1786 | | -以下の接尾辞が使える。 |
| 645 | +正規表現 `.*bar.' や `.*b.*3' は使用できるが、`f.*r3' は使用できない。 |
| 646 | +\fBfind\fP が理解する正規表現は、デフォルトでは Emacs の正規表現だが、 |
| 647 | +これは \fB\-regextype\fP オプションで変更することができる。 |
| 648 | + |
| 649 | +.IP "\-samefile \fIname\fP" |
| 650 | +ファイルが \fIname\fP と同じ inode を参照していれば、真を返す。 \fB\-L\fP が有効な場合、シンボリックリンクも真を返す。 |
| 651 | + |
| 652 | +.IP "\-size \fIn\fP[cwbkMG]" |
| 653 | +ファイルが \fIn\fP 単位分の領域を使用していれば、真を返す |
| 654 | +(対象となるファイルのサイズを、単位にまで切り上げて比較する)。以下の接尾辞が使える。 |
1787 | 655 | .RS |
| 656 | +.IP "[\fB訳注\fP]:" 8 |
| 657 | +ブロック数を指定するときは、注意していただきたい。 |
| 658 | +\fB\-size\fP では、検査対象ファイルのブロック数の算出を、単にファイルのサイズを |
| 659 | +512 で割り、その結果を切り上げて整数にすることで行っている。 |
| 660 | +これは、\fBstat\fP コマンドの出力や POSIXLY_CORRECT が設定されているときの |
| 661 | +\fBls \-s\fP の結果と、同じではないことが多い。\fBstat\fP や \fBls\fP |
| 662 | +は、ファイルに対するディスクスペースの割当が、ファイルシステムのブロックサイズ |
| 663 | +(ext4 なら、たいてい 4096 バイト、つまり 8 ブロック) |
| 664 | +の倍数で行われることを考慮に入れているのである。なお、アクション |
| 665 | +\fB\-printf\fP における `%b' の出力は、\fBstat\fP などと同じである。 |
1788 | 666 | .IP `b' |
1789 | | -単位はブロック。1 ブロックは 512 バイト。(これが接尾辞を使わないときの |
1790 | | -デフォルトである) |
| 667 | +単位はブロック。1 ブロックは 512 バイト。(これが接尾辞を使わないときの デフォルトである) |
1791 | 668 | .IP `c' |
1792 | 669 | 単位はバイト。 |
1793 | 670 | .IP `w' |
1794 | 671 | 単位はワード。1 ワードは 2 バイト。 |
1795 | 672 | .IP `k |
1796 | | -単位はキロバイト (1 キロバイトは 1024 バイト)。 |
| 673 | +単位はキビバイト (1 キビバイトは 1024 バイト)。 |
1797 | 674 | .IP `M' |
1798 | | -単位はメガバイト (1 メガバイトは 1048576 バイト)。 |
| 675 | +単位はメビバイト (1 メビバイトは 1048576 バイト)。 |
1799 | 676 | .IP `G' |
1800 | | -単位はギガバイト (1 ギガバイトは 1073741824 バイト)。 |
| 677 | +単位はギビバイト (1 ギビバイトは 1073741824 バイト)。 |
1801 | 678 | .RE |
1802 | | -.\"O .IP |
1803 | | -.\"O The size does not count indirect blocks, but it does count blocks in |
1804 | | -.\"O sparse files that are not actually allocated. Bear in mind that the |
1805 | | -.\"O `%k' and `%b' format specifiers of |
1806 | | -.\"O .B \-printf |
1807 | | -.\"O handle sparse files |
1808 | | -.\"O differently. The `b' suffix always denotes 512-byte blocks and never |
1809 | | -.\"O 1 Kilobyte blocks, which is different to the behaviour of |
1810 | | -.\"O .BR \-ls . |
1811 | | -.\"O |
1812 | 679 | .IP |
1813 | | -サイズには間接ブロック (indirect block) の分は含まれないが、 |
1814 | | -穴空きファイル (sparse file) における、実際には割り当てられていない |
1815 | | -ブロックの分は含まれる。アクション |
1816 | | -.B \-printf |
1817 | | -の |
1818 | | -`%k' や `%b' 書式指定子とは穴空きファイルの扱い方が違うことを、 |
1819 | | -心にとめておいてほしい。接尾辞 `b' は常に 512 バイトのブロックを |
1820 | | -意味し、1 キロバイトのブロックを指すことはない。その点が、アクション |
1821 | | -.B \-ls |
1822 | | -の動作と異なっている。 |
1823 | | - |
1824 | | -.\"O .IP \-true |
1825 | | -.\"O Always true. |
1826 | | -.\"O |
| 680 | +サイズには間接ブロック (indirect block) の分は含まれないが、穴空きファイル |
| 681 | +(sparse file) における、実際には割り当てられていないブロックの分は含まれる。 |
| 682 | +アクション \fB\-printf\fP の `%k' や `%b' 書式指定子とは、穴空きファイルの扱い方が違うことを心にとめておいていただきたい。 |
| 683 | +また、接尾辞 `b' は常に 512 バイトのブロックを意味し、1 キロバイトのブロックを指すことはない。 |
| 684 | +その点で、アクション \fB\-ls\fP の動作とは異なっている。 |
| 685 | +数値の前に + や \- を付けると、他の場合と同様、「より大きい」や「より小さい」を意味することになるが、 |
| 686 | +ファイルのサイズは、単位以下の部分が、単位にまで切り上げられることに留意していただきたい |
| 687 | +(だから、1 byte のファイルは、\fB\-size \-1M\fP にマッチしない。(訳注: \fB\-size 1M\fP とならマッチする))。 |
1827 | 688 | .IP \-true |
1828 | 689 | 常に真。 |
1829 | 690 | |
1830 | | -.\"O .IP "\-type \fIc\fR" |
1831 | | -.\"O File is of type \fIc\fR: |
1832 | | -.IP "\-type \fIc\fR" |
1833 | | -ファイルのタイプが \fIc\fR であれば真。\fIc\fR の位置には実際には |
1834 | | -以下の文字が来る。 |
1835 | | -.\"O .RS |
1836 | | -.\"O .IP b |
1837 | | -.\"O block (buffered) special |
| 691 | +.IP "\-type \fIc\fP" |
| 692 | +ファイルのタイプが \fIc\fP であれば真。(訳注: \fIc\fP の位置には実際には以下の文字が来る。) |
1838 | 693 | .RS |
1839 | 694 | .IP b |
1840 | 695 | ブロック・スペシャルファイル (バッファあり) |
1841 | | -.\"O .IP c |
1842 | | -.\"O character (unbuffered) special |
1843 | 696 | .IP c |
1844 | 697 | キャラクタ・スペシャルファイル (バッファなし) |
1845 | | -.\"O .IP d |
1846 | | -.\"O directory |
1847 | 698 | .IP d |
1848 | 699 | ディレクトリ |
1849 | | -.\"O .IP p |
1850 | | -.\"O named pipe (FIFO) |
1851 | 700 | .IP p |
1852 | 701 | 名前付きパイプ (FIFO) |
1853 | | -.\"O .IP f |
1854 | | -.\"O regular file |
1855 | 702 | .IP f |
1856 | 703 | 通常のファイル |
1857 | | -.\"O .IP l |
1858 | | -.\"O symbolic link; this is never true if the |
1859 | | -.\"O .B \-L |
1860 | | -.\"O option or the |
1861 | | -.\"O .B \-follow |
1862 | | -.\"O option is in effect, unless the symbolic link is broken. If you want |
1863 | | -.\"O to search for symbolic links when |
1864 | | -.\"O .B \-L |
1865 | | -.\"O is in effect, use |
1866 | | -.\"O .BR \-xtype . |
1867 | 704 | .IP l |
1868 | | -シンボリックリンク。オプション |
1869 | | -.B \-L |
1870 | | -や |
1871 | | -.B \-follow |
1872 | | -が有効な場合、シンボリックリンクがリンク切れの場合を除いて、 |
1873 | | -この判別式が真になることはない。 |
1874 | | -.B \-L |
1875 | | -が有効なときにシンボリックリンクを検索したかったら、 |
1876 | | -.B \-xtype |
1877 | | -を使うべきである。 |
1878 | | -.\"O .IP s |
1879 | | -.\"O socket |
| 705 | +シンボリックリンク。オプション \fB\-L\fP や \fB\-follow\fP が有効な場合、 |
| 706 | +シンボリックリンクがリンク切れの場合を除いて、この検査が真になることはない。 |
| 707 | +\fB\-L\fP が有効なときにシンボリックリンクを検索したかったら、\fB\-xtype\fP を使うべきである。 |
1880 | 708 | .IP s |
1881 | 709 | ソケット |
1882 | | -.\"O .IP D |
1883 | | -.\"O door (Solaris) |
1884 | | -.\"O .RE |
1885 | 710 | .IP D |
1886 | 711 | ドア (Solaris の場合) |
1887 | 712 | .RE |
1888 | | -.\"O .IP "\-uid \fIn\fR" |
1889 | | -.\"O File's numeric user ID is \fIn\fR. |
1890 | | -.\"O |
1891 | | -.IP "\-uid \fIn\fR" |
1892 | | -ファイル所有者のユーザ ID 番号が \fIn\fR ならば真。 |
1893 | | - |
1894 | | -.\"O .IP "\-used \fIn\fR" |
1895 | | -.\"O File was last accessed \fIn\fR days after its status was last changed. |
1896 | | -.\"O |
1897 | | -.IP "\-used \fIn\fR" |
1898 | | -ファイルが最後にアクセスされたのが、ファイルのステータスが最後に |
1899 | | -変更されてから \fIn\fR 日後ならば、真を返す。 |
1900 | | - |
1901 | | -.\"O .IP "\-user \fIuname\fR" |
1902 | | -.\"O File is owned by user \fIuname\fR (numeric user ID allowed). |
1903 | | -.\"O |
1904 | | -.IP "\-user \fIuname\fR" |
1905 | | -ファイルの所有者が \fIuname\fR というユーザならば真 |
1906 | | -(ユーザ ID 番号で指定してもよい)。 |
1907 | | - |
1908 | | -.\"O .IP "\-wholename \fIpattern\fR" |
1909 | | -.\"O See \-path. This alternative is less portable than |
1910 | | -.\"O .BR \-path . |
1911 | | -.\"O |
1912 | | -.IP "\-wholename \fIpattern\fR" |
1913 | | -.B \-path |
1914 | | -と同じである。この別名は移植性で |
1915 | | -.B \-path |
1916 | | -に劣る。 |
1917 | | - |
1918 | | -.\"O .IP "\-writable" |
1919 | | -.\"O Matches files which are writable. This takes into account access |
1920 | | -.\"O control lists and other permissions artefacts which the |
1921 | | -.\"O .B \-perm |
1922 | | -.\"O test ignores. This test makes use of the |
1923 | | -.\"O .BR access (2) |
1924 | | -.\"O system call, and so can be fooled by NFS servers which do UID |
1925 | | -.\"O mapping (or root-squashing), since many systems implement |
1926 | | -.\"O .BR access (2) |
1927 | | -.\"O in the client's kernel and so cannot make use of the UID mapping |
1928 | | -.\"O information held on the server. |
1929 | | -.\"O |
1930 | | -.IP "\-writable" |
1931 | | -書き込み可能なファイルにマッチする。判別式 |
1932 | | -.B \-perm |
1933 | | -が ACL (アクセス・コントロール・リスト) などのパーミッション制御の |
1934 | | -仕組みを無視するのに対して、この判別式は ACL なども考慮に入れる。 |
1935 | | -この判別式は |
1936 | | -.BR access (2) |
1937 | | -システムコールを使用しているので、UID マッピング (または |
1938 | | -root-squashing) を行っている NFS サーバがあると、正確な結果を |
1939 | | -得られないことがある。なぜなら、たいていのシステムは |
1940 | | -.BR access (2) |
1941 | | -をクライアントのカーネルで実装しており、それ故、サーバ側に保持されている |
| 713 | +.IP "\-uid \fIn\fP" |
| 714 | +ファイル所有者のユーザ ID 番号が \fIn\fP ならば真。 |
| 715 | + |
| 716 | +.IP "\-used \fIn\fP" |
| 717 | +ファイルが最後にアクセスされたのが、ファイルの最終ステータス変更日時より |
| 718 | +\fIn\fP 日後ならば、真を返す。 |
| 719 | + |
| 720 | +.IP "\-user \fIuname\fP" |
| 721 | +ファイルの所有者が \fIuname\fP というユーザならば真 (ユーザ ID 番号で指定してもよい)。 |
| 722 | + |
| 723 | +.IP "\-wholename \fIpattern\fP" |
| 724 | +\fB\-path\fP と同じである。この別名は移植性で \fB\-path\fP に劣る。 |
| 725 | + |
| 726 | +.IP \-writable |
| 727 | +書き込み可能なファイルにマッチする。検査 \fB\-perm\fP が ACL |
| 728 | +(アクセス・コントロール・リスト) などのパーミッション制御の仕組みを無視するのに対して、 |
| 729 | +この検査は ACL なども考慮に入れる。この検査は \fBaccess\fP(2) |
| 730 | +システムコールを使用しているので、UID マッピング (または root\-squashing) |
| 731 | +を行っている NFS サーバがあると、正確な結果を得られないことがある。なぜなら、たいていのシステムでは |
| 732 | +\fBaccess\fP(2) をクライアントのカーネルで実装しており、それ故、サーバ側に保持されている |
1942 | 733 | UID マッピング情報を利用できないからである。 |
1943 | 734 | |
1944 | | -.\"O .IP "\-xtype \fIc\fR" |
1945 | | -.\"O The same as |
1946 | | -.\"O .B \-type |
1947 | | -.\"O unless the file is a symbolic link. For symbolic |
1948 | | -.\"O links: if the |
1949 | | -.\"O .B \-H |
1950 | | -.\"O or |
1951 | | -.\"O .B \-P |
1952 | | -.\"O option was specified, true if the file is a |
1953 | | -.\"O link to a file of type \fIc\fR; if the |
1954 | | -.\"O .B \-L |
1955 | | -.\"O option has been given, true |
1956 | | -.\"O if \fIc\fR is `l'. In other words, for symbolic links, |
1957 | | -.\"O .B \-xtype |
1958 | | -.\"O checks the type of the file that |
1959 | | -.\"O .B \-type |
1960 | | -.\"O does not check. |
1961 | | -.\"O |
1962 | | -.IP "\-xtype \fIc\fR" |
1963 | | -検査の対象となるファイルがシンボリックリンクでないかぎり、 |
1964 | | -.B \-type |
1965 | | -と同じである。ファイルがシンボリックリンクのときは、以下のように動作する。 |
1966 | | -.B \-H |
1967 | | -や |
1968 | | -.B \-P |
1969 | | -オプションが指定された場合は、リンク先の |
1970 | | -ファイルのタイプが \fIc\fR ならば、真を返す。他方、 |
1971 | | -.B \-L |
1972 | | -オプションが指定されている場合は、\fIc\fR が `l' ならば、真を返す。 |
1973 | | -言い換えると、ファイルがシンボリックであるとき、 |
1974 | | -.B \-xtype |
1975 | | -は、 |
1976 | | -.B \-type |
1977 | | -が検査しない方のファイルのタイプを検査するわけだ。 |
1978 | | - |
1979 | | -.\"O .SS ACTIONS |
| 735 | +.IP "\-xtype \fIc\fP" |
| 736 | +検査の対象となるファイルがシンボリックリンクでないかぎり、\fB\-type\fP と同じである。 |
| 737 | +ファイルがシンボリックリンクのときは、以下のように動作する。 |
| 738 | +\fB\-H\fP や \fB\-P\fP オプションが指定された場合は、タイプが \fIc\fP |
| 739 | +のファイルに対するリンクならば、真を返す。また、\fB\-L\fP |
| 740 | +オプションが指定されている場合は、\fIc\fP が `l' ならば、真を返す。 |
| 741 | +言い換えると、ファイルがシンボリックであるとき、\fB\-xtype\fP |
| 742 | +は、\fB\-type\fP がチェックしない方のファイルのタイプをチェックするわけだ。 |
| 743 | +.IP "\-context \fIpattern\fP" |
| 744 | +(SELinux が有効なときのみ) ファイルのセキュリティ・コンテキストが |
| 745 | +glob のパターン (訳注: つまり、シェル式のパターン) |
| 746 | +\fIpattern\fP にマッチすれば、真を返す。 |
| 747 | + |
1980 | 748 | .SS アクション |
1981 | | -.\"O .IP "\-delete\fR" |
1982 | | -.\"O Delete files; true if removal succeeded. If the removal failed, an |
1983 | | -.\"O error message is issued. |
1984 | | -.\"O If |
1985 | | -.\"O .B \-delete |
1986 | | -.\"O fails, |
1987 | | -.\"O .BR find 's |
1988 | | -.\"O exit status will be nonzero |
1989 | | -.\"O (when it eventually exits). |
1990 | | -.\"O Use of |
1991 | | -.\"O .B \-delete |
1992 | | -.\"O automatically turns on the |
1993 | | -.\"O .B \-depth |
1994 | | -.\"O option. |
1995 | | -.\"O |
1996 | | -.IP "\-delete\fR" |
1997 | | -ファイルを消去する。消去に成功すれば、真を返す。消去に失敗した場合は、 |
1998 | | -エラーメッセージを表示する。 |
1999 | | -.B \-delete |
2000 | | -に失敗した場合の |
2001 | | -.B find |
2002 | | -の終了ステータスは、ゼロ以外である (最終的に終了したときの |
2003 | | -終了ステータスのことである)。 |
2004 | | -.B \-delete |
2005 | | -を使用すると、自動的に |
2006 | | -.B \-depth |
2007 | | -オプションが有効になる。 |
2008 | | - |
2009 | | -.\"O .BR Warnings : |
2010 | | -.\"O Don't forget that the find command line is |
2011 | | -.\"O evaluated as an expression, so putting |
2012 | | -.\"O .B \-delete |
2013 | | -.\"O first will make |
2014 | | -.\"O .B find |
2015 | | -.\"O try to delete everything below the starting points you specified. |
2016 | | -.BR 警告 : |
2017 | | -忘れないでほしいが、find のコマンドラインは一つの式 (expression) として |
2018 | | -評価されるので、一番最初に |
2019 | | -.B \-delete |
2020 | | -を指定すると、 |
2021 | | -.B find |
2022 | | -は、指定された探索の開始点以下にあるものを、ことごとく消去しようとする。 |
2023 | | -.\"O When testing a |
2024 | | -.\"O .B find |
2025 | | -.\"O command line that you later intend to use with |
2026 | | -.\"O .BR \-delete , |
2027 | | -.\"O you should explicitly specify |
2028 | | -.\"O .B \-depth |
2029 | | -.\"O in order to avoid later surprises. Because |
2030 | | -.\"O .B \-delete |
2031 | | -.\"O implies |
2032 | | -.\"O .BR \-depth , |
2033 | | -.\"O you cannot usefully use |
2034 | | -.\"O .B \-prune |
2035 | | -.\"O and |
2036 | | -.\"O .B \-delete |
2037 | | -.\"O together. |
2038 | | -.\"O |
2039 | | -後で |
2040 | | -.B \-delete |
2041 | | -を付けて使用するつもりで、 |
2042 | | -.B find |
2043 | | -のコマンドラインをテスト実行するときは、 |
2044 | | -.B \-depth |
2045 | | -を明示的に指定するとよい。そうすれば、後で「こんなはずではなかった」と |
2046 | | -慌てないですむ。 |
2047 | | -.B \-delete |
2048 | | -を指定すると自動的に |
2049 | | -.B \-depth |
2050 | | -が有効になるので、 |
2051 | | -.B \-prune |
2052 | | -を |
2053 | | -.B \-delete |
2054 | | -と一緒に使っても役に立たない。 |
2055 | | - |
2056 | | -.\"O .IP "\-exec \fIcommand\fR ;" |
2057 | | -.\"O Execute \fIcommand\fR; true if 0 status is returned. All following |
2058 | | -.\"O arguments to |
2059 | | -.\"O .B find |
2060 | | -.\"O are taken to be arguments to the command until an argument consisting |
2061 | | -.\"O of `;' is encountered. The string `{}' is replaced by the current |
2062 | | -.\"O file name being processed everywhere it occurs in the arguments to the |
2063 | | -.\"O command, not just in arguments where it is alone, as in some versions |
2064 | | -.\"O of |
2065 | | -.\"O .BR find . |
2066 | | -.IP "\-exec \fIcommand\fR ;" |
2067 | | -\fIcommand\fR を実行する。\fIcommand\fR の返り値が 0 ならば、真を返す。 |
2068 | | -.B find |
2069 | | -のコマンドラインで指定されたこれ以降の引き数は、`;' という引き数が現れるまで、 |
2070 | | -すべてコマンドに対する引き数と見なされる。文字列 `{}' は、 |
2071 | | -それがコマンドの引き数中に現れるすべての場所で、現在処理中のファイル名に |
2072 | | -置き換えられる。 |
2073 | | -.B find |
2074 | | -の一部の版とは違い、`{}' は引き数中の一ヶ所でしか使えないわけではない。 |
2075 | | -.\"O Both of these constructions might need to be escaped (with a `\e') or |
2076 | | -.\"O quoted to protect them from expansion by the shell. See the |
2077 | | -.\"O .B EXAMPLES |
2078 | | -.\"O section for examples of the use of the |
2079 | | -.\"O .B \-exec |
2080 | | -.\"O option. The specified |
2081 | | -.\"O command is run once for each matched file. |
2082 | | -.\"O The command is executed in the starting directory. There are |
2083 | | -.\"O unavoidable security problems surrounding use of the |
2084 | | -.\"O .B \-exec |
2085 | | -.\"O action; |
2086 | | -.\"O you should use the |
2087 | | -.\"O .B \-execdir |
2088 | | -.\"O option instead. |
2089 | | -.\"O |
2090 | | -こうした構文の要素 (訳注: すなわち、`{}' と `;') は、シェルによって |
2091 | | -展開されないように、どちらも `\e' でエスケープするなり、 |
2092 | | -引用符で囲むなりする必要があるかもしれない。アクション |
2093 | | -.B \-exec |
2094 | | -の使用例については「用例」セクションを見てほしい。 |
| 749 | +.IP \-delete |
| 750 | +ファイルを消去する。消去に成功すれば、真を返す。 |
| 751 | +消去に失敗した場合は、エラーメッセージを表示する。 |
| 752 | +\fB\-delete\fP に失敗した場合の \fBfind\fP の終了ステータスは、ゼロ以外である |
| 753 | +(\fBfind\fP が最終的に終了したときの終了ステータスのことだ)。\fB\-delete\fP |
| 754 | +を使用すると、自動的に `\fB\-depth\fP' オプションが有効になる。 |
| 755 | + |
| 756 | +\fB警告\fP: 忘れないでいただきたいが、find のコマンドラインは一つの式 (expression) |
| 757 | +として評価されるので、一番最初に \fB\-delete\fP を指定すると、 |
| 758 | +\fBfind\fP は、指定された探索の開始点以下にあるものを、ことごとく消去しようとする。 |
| 759 | +後で \fB\-delete\fP を付けて使用するつもりで、\fBfind\fP |
| 760 | +のコマンドラインをテスト実行するときは、\fB\-depth\fP を明示的に指定するとよい。 |
| 761 | +そうすれば、後で「こんなはずではなかった」と慌てないですむ。 |
| 762 | +\fB\-delete\fP を指定すると自動的に \fB\-depth\fP が有効になるので、\fB\-prune\fP |
| 763 | +を \fB\-delete\fP と一緒に使っても役に立たない。 |
| 764 | + |
| 765 | +.IP "\-exec \fIcommand\fP ;" |
| 766 | +\fIcommand\fP を実行する。\fIcommand\fP の返り値が 0 ならば、真を返す。 |
| 767 | +\fBfind\fP のコマンドラインで指定されているこれ以降の引き数は、`;' という引き数が現れるまで、すべてコマンドに対する引き数と見なされる。 |
| 768 | +文字列 `{}' は、それがコマンドの引き数中に現れるすべての場所で、現在処理中のファイル名に置き換えられる。 |
| 769 | +\fBfind\fP の一部の版とは違い、`{}' は引き数中の一ヶ所でしか使えないわけではない。 |
| 770 | +こうした構文の要素 (訳注: すなわち、`{}' や `;') は、シェルによって展開されないように、 |
| 771 | +どちらも `\e' でエスケープするなり、引用符で囲むなりする必要があるかもしれない。 |
| 772 | +アクション \fB\-exec\fP の使用例については「用例」セクションを見ていただきたい。 |
2095 | 773 | 指定したコマンドは、マッチした各ファイルに対して一回づつ実行される。 |
2096 | | -また、コマンドは |
2097 | | -.B find |
2098 | | -を実行したディレクトリで実行される。そこで、 |
2099 | | -.B \-exec |
2100 | | -アクションの使用に関しては、セキュリティの問題が避けられないわけだ。 |
2101 | | -.B \-exec |
2102 | | -の代わりに、 |
2103 | | -.B \-execdir |
2104 | | -アクションを使用することをお勧めする。 |
2105 | | -(訳注: `;' は引き数なので、直前の引き数との間に空白が必要だ |
2106 | | -ということに注意してほしい。) |
2107 | | - |
2108 | | -.\"O .IP "\-exec \fIcommand\fR {} +" |
2109 | | -.\"O This variant of the |
2110 | | -.\"O .B \-exec |
2111 | | -.\"O action runs the specified command on the |
2112 | | -.\"O selected files, but the command line is built by appending each |
2113 | | -.\"O selected file name at the end; the total number of invocations of the |
2114 | | -.\"O command will be much less than the number of matched files. The |
2115 | | -.\"O command line is built in much the same way that |
2116 | | -.\"O .B xargs |
2117 | | -.\"O builds its command lines. Only one instance of `{}' is allowed within |
2118 | | -.\"O the command. The command is executed in the starting directory. |
2119 | | -.\"O |
2120 | | -.IP "\-exec \fIcommand\fR {} +" |
2121 | | -アクション |
2122 | | -.B \-exec |
2123 | | -のこの変形も、選択したファイルに対して指定したコマンドを実行するが、 |
2124 | | -コマンドラインを形成するとき、選択した各ファイル名をコマンドラインの末尾に |
2125 | | -追加して行くという方法を取る (訳注: コマンドラインが長くなりすぎるときは、 |
2126 | | -処理するファイル名の数を適切に分割して、コマンドを複数回実行する)。 |
2127 | | -そのため、コマンドを呼び出す回数は、マッチしたファイルの数より |
2128 | | -ずっと少なくてすむわけだ。コマンドラインの形成法は、 |
2129 | | -.B xargs |
2130 | | -のコマンドライン形成法とほぼ同じである。`{}' はコマンドライン中の |
2131 | | -一ヶ所でしか使えない。コマンドは |
2132 | | -.B find |
2133 | | -を実行したディレクトリで実行される。 |
2134 | | -(訳注: `+' は引き数なので、直前の引き数との間に空白が必要だ |
2135 | | -ということに注意してほしい。) |
2136 | | - |
2137 | | -.\"O .IP "\-execdir \fIcommand\fR ;" |
2138 | | -.\"O .IP "\-execdir \fIcommand\fR {} +" |
2139 | | -.\"O Like |
2140 | | -.\"O .BR \-exec , |
2141 | | -.\"O but the specified command is run from the subdirectory |
2142 | | -.\"O containing the matched file, which is not normally the directory in |
2143 | | -.\"O which you started |
2144 | | -.\"O .BR find . |
2145 | | -.\"O This a much more secure method for invoking commands, as it avoids |
2146 | | -.\"O race conditions during resolution of the paths to the matched files. |
2147 | | -.IP "\-execdir \fIcommand\fR ;" |
2148 | | -.IP "\-execdir \fIcommand\fR {} +" |
2149 | | -.B \-exec |
2150 | | -と似ているが、指定したコマンドはマッチしたファイルが存在するサブディレクトリで |
2151 | | -実行される。そのサブディレクトリは、 |
2152 | | -.B find |
2153 | | -を実行したディレクトリとは違うのが普通だ。 |
2154 | | -これはコマンドを呼び出す方法としてずっと安全である。マッチしたファイルの |
2155 | | -パスを解決する際に、競合状態が起きるのを避けられるからだ。 |
2156 | | -.\"O As with the |
2157 | | -.\"O .B \-exec |
2158 | | -.\"O action, the `+' form of |
2159 | | -.\"O .B \-execdir |
2160 | | -.\"O will build a |
2161 | | -.\"O command line to process more than one matched file, but any given |
2162 | | -.\"O invocation of |
2163 | | -.\"O .I command |
2164 | | -.\"O will only list files that exist in the same subdirectory. If you use |
2165 | | -.\"O this option, you must ensure that your |
2166 | | -.\"O .B $PATH |
2167 | | -.\"O environment variable does not reference `.'; |
2168 | | -.\"O otherwise, an attacker can run any commands they like by leaving an |
2169 | | -.\"O appropriately-named file in a directory in which you will run |
2170 | | -.\"O .BR \-execdir . |
2171 | | -.\"O The same applies to having entries in |
2172 | | -.\"O .B $PATH |
2173 | | -.\"O which are empty or which are not absolute directory names. |
2174 | | -.\"O |
2175 | | -アクション |
2176 | | -.B \-exec |
2177 | | -の場合と同様、 |
2178 | | -.B \-execdir |
2179 | | -の `+' を伴う形式でも、 |
2180 | | -マッチした複数のファイルを一度に処理するように、コマンドラインを |
2181 | | -形成することになる。しかし、 |
2182 | | -.I command |
2183 | | -のどの呼び出しにおいても、処理の対象としてリストされるファイルは、 |
2184 | | -同じサブディレクトリに存在するものだけである。このアクションを |
2185 | | -使用するのなら、環境変数 |
2186 | | -.B $PATH |
2187 | | -が `.' を参照しないようにしなければならない。 |
2188 | | -さもないと、悪意を持った攻撃者が、あなたが |
2189 | | -.B \-execdir |
2190 | | -を実行することになるディレクトリに適当な名前のファイルを |
2191 | | -入れておくことによって、何でも好きなコマンドを実行できてしまうからである。 |
2192 | | -.B $PATH |
2193 | | -の中に、空っぽのエントリや、絶対パスのディレクトリ名ではない |
2194 | | -エントリがある場合にも、同じことが当てはまる。 |
2195 | | - |
2196 | | -.\"O .IP "\-fls \fIfile\fR" |
2197 | | -.\"O True; like |
2198 | | -.\"O .B \-ls |
2199 | | -.\"O but write to \fIfile\fR like |
2200 | | -.\"O .BR \-fprint . |
2201 | | -.\"O The output file is always created, even if the predicate is never |
2202 | | -.\"O matched. |
2203 | | -.\"O See the |
2204 | | -.\"O .B UNUSUAL FILENAMES |
2205 | | -.\"O section for information about how unusual characters in filenames are handled. |
2206 | | -.\"O |
2207 | | -.IP "\-fls \fIfile\fR" |
2208 | | -真を返す。 |
2209 | | -.B \-ls |
2210 | | -と似ているが、 |
2211 | | -.B \-fprint |
2212 | | -同様、出力を \fIfile\fR に書き出す点が違う。 |
2213 | | -出力用のファイルは、この述語の対象になるものが一つもなかった場合でも、 |
2214 | | -必ず作成される。 |
2215 | | -ファイル名中の変わった文字がどのように扱われるかについては、 |
2216 | | -「変わり者のファイル名」セクションを参照してほしい。 |
2217 | | - |
2218 | | -.\"O .IP "\-fprint \fIfile\fR" |
2219 | | -.\"O True; print the full file name into file \fIfile\fR. If \fIfile\fR |
2220 | | -.\"O does not exist when \fBfind\fR is run, it is created; if it does |
2221 | | -.\"O exist, it is truncated. The file names ``/dev/stdout'' and |
2222 | | -.\"O ``/dev/stderr'' are handled specially; they refer to the standard |
2223 | | -.\"O output and standard error output, respectively. |
2224 | | -.\"O The output file is always created, even if the predicate is never matched. |
2225 | | -.\"O See the |
2226 | | -.\"O .B UNUSUAL FILENAMES |
2227 | | -.\"O section for information about how unusual characters in filenames are handled. |
2228 | | -.\"O |
2229 | | -.IP "\-fprint \fIfile\fR" |
2230 | | -真を返す。パス付きのファイル名をファイル \fIfile\fR に出力する。 |
2231 | | -\fBfind\fR の実行時に \fIfile\fR が存在しなければ、 |
2232 | | -新たに作成される。すでに存在していれば、元の中身が捨てられる。 |
2233 | | -ファイル名 ``/dev/stdout'' と ``/dev/stderr'' の扱いは特別で、 |
2234 | | -それぞれ標準出力と標準エラー出力を指している。 |
2235 | | -出力用のファイルは、この述語の対象になるものが一つもなかった場合でも、 |
2236 | | -必ず作成される。 |
2237 | | -ファイル名中の変わった文字がどのように扱われるかについては、 |
2238 | | -「変わり者のファイル名」セクションを参照してほしい。 |
2239 | | - |
2240 | | -.\"O .IP "\-fprint0 \fIfile\fR" |
2241 | | -.\"O True; like |
2242 | | -.\"O .B \-print0 |
2243 | | -.\"O but write to \fIfile\fR like |
2244 | | -.\"O .BR \-fprint . |
2245 | | -.\"O The output file is always created, even if the predicate is never matched. |
2246 | | -.\"O See the |
2247 | | -.\"O .B UNUSUAL FILENAMES |
2248 | | -.\"O section for information about how unusual characters in filenames are handled. |
2249 | | -.\"O |
2250 | | -.IP "\-fprint0 \fIfile\fR" |
2251 | | -真を返す。 |
2252 | | -.B \-print0 |
2253 | | -と似ているが、 |
2254 | | -.B \-fprint |
2255 | | -同様、出力を \fIfile\fR に書き出す点が違う。 |
2256 | | -出力用のファイルは、この述語の対象になるものが一つもなかった場合でも、 |
2257 | | -必ず作成される。 |
2258 | | -ファイル名中の変わった文字がどのように扱われるかについては、 |
2259 | | -「変わり者のファイル名」セクションを参照してほしい。 |
2260 | | - |
2261 | | -.\"O .IP "\-fprintf \fIfile\fR \fIformat\fR" |
2262 | | -.\"O True; like |
2263 | | -.\"O .B \-printf |
2264 | | -.\"O but write to \fIfile\fR like |
2265 | | -.\"O .BR \-fprint . |
2266 | | -.\"O The output file is always created, even if the predicate is never matched. |
2267 | | -.\"O See the |
2268 | | -.\"O .B UNUSUAL FILENAMES |
2269 | | -.\"O section for information about how unusual characters in filenames are handled. |
2270 | | -.\"O |
2271 | | -.IP "\-fprintf \fIfile\fR \fIformat\fR" |
2272 | | -真を返す。 |
2273 | | -.B \-printf |
2274 | | -と似ているが、 |
2275 | | -.B \-fprint |
2276 | | -同様、出力を \fIfile\fR に書き出す点が違う。 |
2277 | | -出力用のファイルは、この述語の対象になるものが一つもなかった場合でも、 |
2278 | | -必ず作成される。 |
2279 | | -ファイル名中の変わった文字がどのように扱われるかについては、 |
2280 | | -「変わり者のファイル名」セクションを参照してほしい。 |
2281 | | - |
2282 | | -.\"O .IP \-ls |
2283 | | -.\"O True; list current file in |
2284 | | -.\"O .B ls \-dils |
2285 | | -.\"O format on standard output. |
2286 | | -.\"O The block counts are of 1K blocks, unless the environment variable |
2287 | | -.\"O POSIXLY_CORRECT is set, in which case 512-byte blocks are used. |
2288 | | -.\"O See the |
2289 | | -.\"O .B UNUSUAL FILENAMES |
2290 | | -.\"O section for information about how unusual characters in filenames are handled. |
2291 | | -.\"O |
| 774 | +また、コマンドは \fBfind\fP を実行したディレクトリで実行される。 |
| 775 | +そこで、\fB\-exec\fP アクションの使用を巡っては、セキュリティの問題が避けられないわけであり、 |
| 776 | +\fB\-exec\fP の代わりに、\fB\-execdir\fP アクションを使用することをお勧めする。 |
| 777 | +(訳注: `;' は引き数なので、直前の引き数との間に空白が必要だということに注意していただきたい。) |
| 778 | + |
| 779 | +.IP "\-exec \fIcommand\fP {} +" |
| 780 | +アクション \fB\-exec\fP のこの変形も、選択したファイルに対して指定したコマンドを実行するが、 |
| 781 | +コマンドラインを形成するとき、選択した各ファイル名をコマンドラインの末尾に追加して行くという方法を取る |
| 782 | +(訳注: コマンドラインが長くなりすぎるときは、処理するファイル名のリストを適宜分割して、コマンドを複数回実行する)。 |
| 783 | +そのため、コマンドを呼び出す回数が、マッチしたファイルの数よりずっと少なくてすむ。 |
| 784 | +コマンドラインの形成法は、 \fBxargs\fP のコマンドライン形成法とほぼ同じである。 |
| 785 | +`{}' はコマンドライン中の一ヶ所でしか使えない。 |
| 786 | +なお、コマンドは \fBfind\fP を実行したディレクトリで実行される。 |
| 787 | +\fBfind\fP がエラーに出会うと、このアクションは \fBfind\fP をその場で終了させてしまうことがあり、 |
| 788 | +そのため、予定されているコマンドの中に全く実行されないものが生ずるかもしれない。 |
| 789 | +\fB\-exec\fP のこの変形は、常に真を返す。 |
| 790 | +(訳注: `+' は引き数なので、直前の引き数との間に空白が必要だということに注意していただきたい。) |
| 791 | + |
| 792 | +.IP "\-execdir \fIcommand\fP ;" |
| 793 | +.IP "\-execdir \fIcommand\fP {} +" |
| 794 | +\fB\-exec\fP と似ているが、指定したコマンドを、マッチしたファイルが存在するサブディレクトリで実行するという点が異なっている。 |
| 795 | +そのサブディレクトリは、 \fBfind\fP を実行したディレクトリとは違うのが普通だ。 |
| 796 | +これはコマンドを呼び出す方法としてずっと安全である。マッチしたファイルのパスを解決する際に、競合状態が起きるのを避けられるからだ。 |
| 797 | +アクション \fB\-exec\fP の場合と同様、 \fB\-execdir\fP の `+' を伴う形式でも、 |
| 798 | +マッチした複数のファイルを一度に処理するように、コマンドラインを形成することになるが、 |
| 799 | +\fIcommand\fP のどの呼び出しにおいても、処理の対象としてリストされるファイルは、同じサブディレクトリに存在するものだけである。 |
| 800 | +このアクションを使用するのなら、環境変数 \fB$PATH\fP が `.' を参照しないようにしなければならない。 |
| 801 | +さもないと、悪意を持った攻撃者が、あなたが \fB\-execdir\fP を実行することになるディレクトリに適当な名前のファイルを入れておくことによって、 |
| 802 | +何でも好きなコマンドを実行できてしまうからだ。 |
| 803 | +\fB$PATH\fP の中に、空っぽのエントリや、絶対パスのディレクトリ名ではないエントリがある場合にも、同じことが言える。 |
| 804 | +\fBfind\fP がエラーに出会うと、このアクションは \fBfind\fP をその場で終了させてしまうことがあり、 |
| 805 | +そのため、予定されているコマンドの中に全く実行されないものが生ずるかもしれない。 |
| 806 | +このアクションが返す値は、\fB+\fP と \fB;\fP のどちらを使うかによって異なっている。 |
| 807 | +\fB\-execdir\fP \fIcommand\fP \fB{} +\fP が常に真を返すのに対して、\fB\-execdir\fP \fIcommand\fP \fB{} ;\fP |
| 808 | +は、\fIcommand\fP が 0 を返したときのみ、真を返すのである。 |
| 809 | + |
| 810 | + |
| 811 | +.IP "\-fls \fIfile\fP" |
| 812 | +真を返す。\fB\-ls\fP と似ているが、\fB\-fprint\fP 同様、出力を \fIfile\fP に書き出す点が違う。 |
| 813 | +出力用のファイルは、この述語の対象になるものが一つもなかった場合でも、必ず作成される。 |
| 814 | +ファイル名中の普通使わない文字がどのように扱われるかについては、「変わり者のファイル名」セクションを参照していただきたい。 |
| 815 | + |
| 816 | +.IP "\-fprint \fIfile\fP" |
| 817 | +真を返す。パス付きのファイル名をファイル \fIfile\fP に出力する。 |
| 818 | +\fBfind\fP の実行時に \fIfile\fP が存在しなければ、新たに作成される。 |
| 819 | +すでに存在していれば、元の中身が捨てられる。ファイル名 `/dev/stdout' と |
| 820 | +`/dev/stderr' の扱いは特別で、それぞれ標準出力と標準エラー出力を指している。 |
| 821 | +出力用のファイルは、この述語の対象になるものが一つもなかった場合でも、必ず作成される。 |
| 822 | +ファイル名中の普通使わない文字がどのように扱われるかについては、「変わり者のファイル名」セクションを参照していただきたい。 |
| 823 | + |
| 824 | +.IP "\-fprint0 \fIfile\fP" |
| 825 | +真を返す。\fB\-print0\fP と似ているが、\fB\-fprint\fP 同様、出力を \fIfile\fP に書き出す点が違う。 |
| 826 | +出力用のファイルは、この述語の対象になるものが一つもなかった場合でも、必ず作成される。 |
| 827 | +ファイル名中の普通使わない文字がどのように扱われるかについては、「変わり者のファイル名」セクションを参照していただきたい。 |
| 828 | + |
| 829 | +.IP "\-fprintf \fIfile\fP \fIformat\fP" |
| 830 | +真を返す。\fB\-printf\fP と似ているが、 \fB\-fprint\fP 同様、出力を \fIfile\fP に書き出す点が違う。 |
| 831 | +出力用のファイルは、この述語の対象になるものが一つもなかった場合でも、必ず作成される。 |
| 832 | +ファイル名中の普通使わない文字がどのように扱われるかについては、「変わり者のファイル名」セクションを参照していただきたい。 |
| 833 | + |
2292 | 834 | .IP \-ls |
2293 | | -真を返す。処理対象のファイルを |
2294 | | -.B ls \-dils |
2295 | | -の書式で標準出力にリストする。ブロック数は、1 ブロック 1 キロバイトの |
2296 | | -計算である。ただし、環境変数 POSIXLY_CORRECT が設定されている場合は、 |
2297 | | -1 ブロック 512 バイトが使用される。 |
2298 | | -ファイル名中の変わった文字がどのように扱われるかについては、 |
2299 | | -「変わり者のファイル名」セクションを参照してほしい。 |
2300 | | - |
2301 | | -.\"O .IP "\-ok \fIcommand\fR ;" |
2302 | | -.\"O Like |
2303 | | -.\"O .B \-exec |
2304 | | -.\"O but ask the user first. If the user agrees, run the command. Otherwise |
2305 | | -.\"O just return false. If the command is run, its standard input is redirected |
2306 | | -.\"O from |
2307 | | -.\"O .BR /dev/null . |
2308 | | -.\"O |
2309 | | -.IP "\-ok \fIcommand\fR ;" |
2310 | | -.B \-exec |
2311 | | -と似ているが、まずユーザに問い合わせを行う。ユーザーが同意すれば、 |
2312 | | -コマンドを実行する。同意しなければ、何もせずに偽を返す。 |
2313 | | -コマンドを実行する際、そのコマンドの標準入力は、 |
2314 | | -.B /dev/null |
2315 | | -に付け換えられる。 |
2316 | | - |
2317 | | -.\"O .IP |
2318 | | -.\"O The response to the prompt is matched against a pair of regular |
2319 | | -.\"O expressions to determine if it is an affirmative or negative |
2320 | | -.\"O response. This regular expression is obtained from the system if the |
2321 | | -.\"O `POSIXLY_CORRECT' environment variable is set, or otherwise from |
2322 | | -.\"O .BR find 's |
2323 | | -.\"O message translations. If the system has no suitable |
2324 | | -.\"O definition, |
2325 | | -.\"O .BR find 's |
2326 | | -.\"O own definition will be used. In either case, the interpretation of |
2327 | | -.\"O the regular expression itself will be affected by the environment |
2328 | | -.\"O variables 'LC_CTYPE' (character classes) and 'LC_COLLATE' (character |
2329 | | -.\"O ranges and equivalence classes). |
2330 | | -.\"O |
2331 | | -.\"O |
2332 | | -.\"O |
| 835 | +真を返す。処理対象のファイルを \fBls \-dils\fP の書式で標準出力にリストする。 |
| 836 | +ブロック数は、1 ブロック 1 キロバイトの計算である。 |
| 837 | +ただし、環境変数 POSIXLY_CORRECT が設定されている場合は、1 ブロック 512 バイトが使用される。 |
| 838 | +ファイル名中の普通使わない文字がどのように扱われるかについては、「変わり者のファイル名」セクションを参照していただきたい。 |
| 839 | + |
| 840 | +.IP "\-ok \fIcommand\fP ;" |
| 841 | +\fB\-exec\fP と似ているが、まずユーザに問い合わせを行う。 |
| 842 | +ユーザーが同意すれば、コマンドを実行する。同意しなければ、何もせずに偽を返す。 |
| 843 | +コマンドを実行する場合、そのコマンドの標準入力は、\fB/dev/null\fP に付け換えられる。 |
| 844 | + |
2333 | 845 | .IP |
2334 | | -プロンプトに対するユーザの応答は、肯定・否定を表す一組の正規表現と照合して、 |
2335 | | -同意か、不同意かが判断される。この正規表現は、環境変数 `POSIXLY_CORRECT' が |
2336 | | -設定されていれば、システムから得られるが、設定されていなければ、 |
2337 | | -.B find |
2338 | | -のメッセージ・カタログから取得される。なお、システムに適切な定義が |
2339 | | -存在しない場合は、 |
2340 | | -.B find |
2341 | | -の持つ定義が使用されることになる。どちらの場合でも、正規表現そのものの |
2342 | | -解釈は、環境変数 'LC_CTYPE' (文字クラスについて) や 'LC_COLLATE' |
2343 | | -(文字の範囲や等価クラスについて) の影響を受ける。 |
2344 | | - |
2345 | | -.\"O .IP "\-okdir \fIcommand\fR ;" |
2346 | | -.\"O Like |
2347 | | -.\"O .B \-execdir |
2348 | | -.\"O but ask the user first in the same way as for |
2349 | | -.\"O .BR \-ok . |
2350 | | -.\"O If the user does not agree, just return false. |
2351 | | -.\"O If the command is run, its standard input is redirected from |
2352 | | -.\"O .BR /dev/null . |
2353 | | -.\"O |
2354 | | -.IP "\-okdir \fIcommand\fR ;" |
2355 | | -.B \-execdir |
2356 | | -と似ているが、 |
2357 | | -.B \-ok |
2358 | | -と同じように、まずユーザに問い合わせを行う。 |
| 846 | +プロンプトに対するユーザの応答は、肯定・否定を表す一組の正規表現と照合して、同意か、不同意かが判断される。 |
| 847 | +この正規表現は、環境変数 `POSIXLY_CORRECT' が設定されていれば、システムから得られるが、 |
| 848 | +設定されていなければ、\fBfind\fP の持つメッセージ翻訳から取得される。 |
| 849 | +なお、システムに適切な定義が存在しない場合は、 \fBfind\fP の持つ定義が使用されることになる。 |
| 850 | +どちらの場合でも、正規表現そのものの解釈は、環境変数 'LC_CTYPE' (文字クラスについて) や |
| 851 | +\&'LC_COLLATE' (文字の範囲や等価クラスについて) の影響を受ける。 |
| 852 | + |
| 853 | + |
| 854 | + |
| 855 | +.IP "\-okdir \fIcommand\fP ;" |
| 856 | +\fB\-execdir\fP と似ているが、\fB\-ok\fP と同じように、まずユーザに問い合わせを行う。 |
2359 | 857 | ユーザが同意しなければ、何もせずに偽を返す。 |
2360 | | -コマンドを実行する際、そのコマンドの標準入力は、 |
2361 | | -.B /dev/null |
2362 | | -に付け換えられる。 |
2363 | | - |
2364 | | -.\"O .IP \-print |
2365 | | -.\"O True; print the full file name on the standard output, followed by a |
2366 | | -.\"O newline. If you are piping the output of |
2367 | | -.\"O .B find |
2368 | | -.\"O into another program and there is the faintest possibility that the files |
2369 | | -.\"O which you are searching for might contain a newline, then you should |
2370 | | -.\"O seriously consider using the |
2371 | | -.\"O .B \-print0 |
2372 | | -.\"O option instead of |
2373 | | -.\"O .BR \-print . |
2374 | | -.\"O See the |
2375 | | -.\"O .B UNUSUAL FILENAMES |
2376 | | -.\"O section for information about how unusual characters in filenames are handled. |
2377 | | -.\"O |
| 858 | +コマンドを実行する場合、そのコマンドの標準入力は、\fB/dev/null\fP に付け換えられる。 |
| 859 | + |
2378 | 860 | .IP \-print |
2379 | | -真を返す。パス付きのファイル名を標準出力に表示し、各ファイル名の後ろに |
2380 | | -改行文字を付ける。 |
2381 | | -.B find |
2382 | | -の出力をパイプを使って他のプログラムに渡している場合、検索対象の |
2383 | | -ファイル名に改行文字が含まれている可能性が、わずかにでもあるならば、 |
2384 | | -アクション |
2385 | | -.B \-print |
2386 | | -ではなく、 |
2387 | | -.B \-print0 |
2388 | | -を使用することを真剣に考えるべきだ。 |
2389 | | -ファイル名中の変わった文字がどのように扱われるかについては、 |
2390 | | -「変わり者のファイル名」セクションを参照してほしい。 |
2391 | | - |
2392 | | -.\"O .IP \-print0 |
2393 | | -.\"O True; print the full file name on the standard output, followed by a |
2394 | | -.\"O null character (instead of the newline character that |
2395 | | -.\"O .B \-print |
2396 | | -.\"O uses). |
2397 | | -.\"O This allows file names that contain newlines or other types of white |
2398 | | -.\"O space to be correctly interpreted by programs that process the |
2399 | | -.\"O \fBfind\fR output. This option corresponds to the |
2400 | | -.\"O .B \-0 |
2401 | | -.\"O option of |
2402 | | -.\"O .BR xargs . |
2403 | | -.\"O |
| 861 | +真を返す。パス付きのファイル名を標準出力に表示し、各ファイル名の後ろに改行文字を付ける。 |
| 862 | +\fBfind\fP の出力をパイプを使って他のプログラムに渡している場合、 |
| 863 | +検索対象のファイル名に改行文字が含まれている可能性が、わずかにでもあるならば、 |
| 864 | +\fB\-print\fP ではなく、 \fB\-print0\fP アクションを使用することを真剣に考えるべきだ。 |
| 865 | +ファイル名中の普通使わない文字がどのように扱われるかについては、「変わり者のファイル名」セクションを参照していただきたい。 |
| 866 | + |
2404 | 867 | .IP \-print0 |
2405 | 868 | 真を返す。パス付きのファイル名を標準出力に表示し、各ファイル名の後ろに |
2406 | | -.RB ( \-print |
2407 | | -が改行文字を付けるのとは違って) |
2408 | | -ヌル文字を付加する。 |
2409 | | -そうすることによって、\fBfind\fR の出力を処理するプログラムが、 |
2410 | | -改行文字などのホワイトスペースを含むファイル名を正しく解釈できる |
2411 | | -ようになるわけだ。このアクションは、 |
2412 | | -.B xargs |
2413 | | -の |
2414 | | -.B \-0 |
2415 | | -オプションに呼応している。 |
2416 | | - |
2417 | | -.\"O .IP "\-printf \fIformat\fR" |
2418 | | -.\"O True; print \fIformat\fR on the standard output, interpreting `\e' |
2419 | | -.\"O escapes and `%' directives. Field widths and precisions can be |
2420 | | -.\"O specified as with the `printf' C function. Please note that many of |
2421 | | -.\"O the fields are printed as %s rather than %d, and this may mean that |
2422 | | -.\"O flags don't work as you might expect. This also means that the `\-' |
2423 | | -.\"O flag does work (it forces fields to be left-aligned). Unlike |
2424 | | -.\"O .BR \-print , |
2425 | | -.\"O .B \-printf |
2426 | | -.\"O does not add a newline at the end of the string. The escapes |
2427 | | -.\"O and directives are: |
2428 | | -.IP "\-printf \fIformat\fR" |
2429 | | -真を返す。標準出力に \fIformat\fR を出力する。 |
2430 | | -そのとき \fIformat\fR 中の `\e' によるエスケープシーケンスと、`%' に |
2431 | | -始まる書式指定子を認識して変換する。 |
2432 | | -フィールドの幅や精度は、C 言語の `printf' 関数と同じやり方で |
2433 | | -指定できる。フィールドの多くは、(`printf' 関数流に言うと) |
2434 | | -%d ではなく、%s として出力されることに注意していただきたい。 |
2435 | | -すなわち、フラグが期待通りに効かないかもしれないのだ。だが、 |
2436 | | -それはまた、`\-' フラグ (フィールドを強制的に左揃えにする) が |
2437 | | -使えるということでもある。 |
2438 | | -.B \-print |
2439 | | -とは違って、 |
2440 | | -.B \-printf |
2441 | | -は文字列の末尾に改行文字を付加しない。 |
| 869 | +(\fB\-print\fP が改行文字を付けるのとは違って) ヌル文字を追加する。 |
| 870 | +このアクションを使えば、\fBfind\fP の出力を処理するプログラムが、改行文字などのホワイトスペースを含むファイル名を正しく解釈できるようになる。 |
| 871 | +このアクションは、\fBxargs\fP の \fB\-0\fP オプションに呼応している。 |
| 872 | + |
| 873 | +.IP "\-printf \fIformat\fP" |
| 874 | +真を返す。標準出力に \fIformat\fP を表示する。そのとき \fIformat\fP 中の |
| 875 | +`\e' によるエスケープシーケンスと、`%' に始まる書式指定子を認識して変換する。 |
| 876 | +フィールドの幅や精度は、C 言語の `printf' 関数と同じ方法で指定できる。 |
| 877 | +%d ではなく、%s として (訳注: すなわち、数値ではなく、文字列として) |
| 878 | +表示されるフィールドが多いことに注意していただきたい。 |
| 879 | +そのため、フラグが期待通りに効かないかもしれないのだ。 |
| 880 | +ただし、`\-' フラグ (フィールドを強制的に左揃えにする) |
| 881 | +はきちんと働くということでもある。\fB\-print\fP とは違って、 |
| 882 | +\fB\-printf\fP は文字列の末尾に改行文字を追加しない。 |
2442 | 883 | バックスラッシュ・エスケープシーケンスと書式指定子は以下のとおりである。 |
2443 | | -.\"O .RS |
2444 | | -.\"O .IP \ea |
2445 | | -.\"O Alarm bell. |
2446 | 884 | .RS |
2447 | 885 | .IP \ea |
2448 | 886 | 警告ベル。 |
2449 | | -.\"O .IP \eb |
2450 | | -.\"O Backspace. |
2451 | 887 | .IP \eb |
2452 | 888 | バックスペース。 |
2453 | | -.\"O .IP \ec |
2454 | | -.\"O Stop printing from this format immediately and flush the output. |
2455 | 889 | .IP \ec |
2456 | | -このフォーマットによる出力をただちに停止し、出力バッファを |
2457 | | -フラッシュする。 |
2458 | | -.\"O .IP \ef |
2459 | | -.\"O Form feed. |
| 890 | +このフォーマットによる出力をただちに停止し、出力をフラッシュする。 |
2460 | 891 | .IP \ef |
2461 | 892 | フォームフィード文字。 |
2462 | | -.\"O .IP \en |
2463 | | -.\"O Newline. |
2464 | 893 | .IP \en |
2465 | 894 | 改行文字。 |
2466 | | -.\"O .IP \er |
2467 | | -.\"O Carriage return. |
2468 | 895 | .IP \er |
2469 | 896 | 復帰文字。 |
2470 | | -.\"O .IP \et |
2471 | | -.\"O Horizontal tab. |
2472 | 897 | .IP \et |
2473 | 898 | 水平タブ。 |
2474 | | -.\"O .IP \ev |
2475 | | -.\"O Vertical tab. |
2476 | 899 | .IP \ev |
2477 | 900 | 垂直タブ。 |
2478 | | -.\"O .IP \e0 |
2479 | | -.\"O ASCII NUL. |
2480 | 901 | .IP \e0 |
2481 | 902 | ASCII NUL 文字。 |
2482 | | -.\"O .IP \e\e |
2483 | | -.\"O A literal backslash (`\e'). |
2484 | 903 | .IP \e\e |
2485 | 904 | バックスラッシュ文字そのもの (`\e')。 |
2486 | | -.\"O .IP \eNNN |
2487 | | -.\"O The character whose ASCII code is NNN (octal). |
2488 | | -.\"O .PP |
2489 | 905 | .IP \eNNN |
2490 | 906 | ASCII コードが NNN (8 進数) の文字。 |
2491 | 907 | .PP |
2492 | | -.\"O A `\e' character followed by any other character is treated as an |
2493 | | -.\"O ordinary character, so they both are printed. |
2494 | | -バックスラッシュ文字 `\e' に上記以外の文字が続く場合、`\e' は |
2495 | | -普通の文字として扱われる。従って、二文字とも表示されるわけだ。 |
2496 | | -.\"O .IP %% |
2497 | | -.\"O A literal percent sign. |
| 908 | +バックスラッシュ文字 `\e' に上記以外の文字が続く場合、`\e' は普通の文字として扱われる。 |
| 909 | +従って、二文字とも表示されることになる。 |
2498 | 910 | .IP %% |
2499 | 911 | パーセント文字そのもの。 |
2500 | | -.\"O .IP %a |
2501 | | -.\"O File's last access time in the format returned by the C `ctime' function. |
2502 | 912 | .IP %a |
2503 | 913 | ファイルの最終アクセス日時を C 言語の `ctime' 関数が返す形式で表示する。 |
2504 | | -.\"O .IP %A\fIk\fP |
2505 | | -.\"O File's last access time in the format specified by \fIk\fR, which is |
2506 | | -.\"O either `@' or a directive for the C `strftime' function. The possible |
2507 | | -.\"O values for \fIk\fR are listed below; some of them might not be |
2508 | | -.\"O available on all systems, due to differences in `strftime' between |
2509 | | -.\"O systems. |
2510 | 914 | .IP %A\fIk\fP |
2511 | | -ファイルの最終アクセス日時を \fIk\fR で指定した書式で表示する。 |
2512 | | -\fIk\fR には `@' か、あるいは C 言語の `strftime' 関数の書式指定子を用いる。 |
2513 | | -\fIk\fR に指定可能な値を以下に列挙する。 |
| 915 | +ファイルの最終アクセス日時を \fIk\fP で指定した書式で表示する。\fIk\fP には |
| 916 | +`@' か、あるいは C 言語の `strftime' 関数の書式指定子を用いる。 |
| 917 | +\fIk\fP に指定可能な値を以下に列挙する。 |
2514 | 918 | 一部のものは使えないシステムがあるかもしれないが、それはシステム間での |
2515 | 919 | `strftime' の非互換性による。 |
2516 | | -.\"O .RS |
2517 | | -.\"O .IP @ |
2518 | | -.\"O seconds since Jan. 1, 1970, 00:00 GMT, with fractional part. |
2519 | | -.\"O .PP |
2520 | 920 | .RS |
2521 | 921 | .IP @ |
2522 | 922 | Jan. 1, 1970, 00:00 GMT からの経過秒数。小数点以下も表示する。 |
2523 | 923 | .PP |
2524 | | -.\"O Time fields: |
2525 | | -.\"O .IP H |
2526 | | -.\"O hour (00..23) |
2527 | 924 | 時刻フィールド: |
2528 | 925 | .IP H |
2529 | 926 | 時 (00..23) |
2530 | | -.\"O .IP I |
2531 | | -.\"O hour (01..12) |
2532 | 927 | .IP I |
2533 | 928 | 時 (01..12) |
2534 | | -.\"O .IP k |
2535 | | -.\"O hour ( 0..23) |
2536 | 929 | .IP k |
2537 | 930 | 時 ( 0..23) |
2538 | | -.\"O .IP l |
2539 | | -.\"O hour ( 1..12) |
2540 | 931 | .IP l |
2541 | 932 | 時 ( 1..12) |
2542 | | -.\"O .IP M |
2543 | | -.\"O minute (00..59) |
2544 | 933 | .IP M |
2545 | 934 | 分 (00..59) |
2546 | | -.\"O .IP p |
2547 | | -.\"O locale's AM or PM |
2548 | 935 | .IP p |
2549 | 936 | 現在のロケールにおける AM/PM の相当語 |
2550 | | -.\"O .IP r |
2551 | | -.\"O time, 12-hour (hh:mm:ss [AP]M) |
2552 | 937 | .IP r |
2553 | 938 | 12 時間制の時刻 (hh:mm:ss [AP]M) |
2554 | | -.\"O .IP S |
2555 | | -.\"O Second (00.00 .. 61.00). There is a fractional part. |
2556 | 939 | .IP S |
2557 | 940 | 秒 (00.00 .. 61.00)。小数点以下も表示。 |
2558 | | -.\"O .IP T |
2559 | | -.\"O time, 24-hour (hh:mm:ss) |
2560 | 941 | .IP T |
2561 | 942 | 24 時間制の時刻 (hh:mm:ss) |
2562 | | -.\"O .IP + |
2563 | | -.\"O Date and time, separated by `+', for example |
2564 | | -.\"O `2004\-04\-28+22:22:05.0'. This is a GNU extension. The time is |
2565 | | -.\"O given in the current timezone (which may be affected by setting the TZ |
2566 | | -.\"O environment variable). The seconds field includes a fractional part. |
2567 | 943 | .IP + |
2568 | | -日付と時刻。両者の間は `2004\-04\-28+22:22:05.0' といった具合に '+' で |
2569 | | -区切られる。これは GNU の拡張である。日時は現在のタイムゾーンのものが |
2570 | | -使われる (それ故、環境変数 TZ の設定によって変わるかもしれない)。 |
2571 | | -秒には小数点以下も付く。 |
2572 | | -.\"O .IP X |
2573 | | -.\"O locale's time representation (H:M:S) |
| 944 | +日付と時刻。両者の間は `2004\-04\-28+22:22:05.0' といった具合に '+' で 区切られる。 |
| 945 | +これは GNU の拡張である。日時は現在のタイムゾーンのものが使われる |
| 946 | +(それ故、環境変数 TZ の設定によって変わるかもしれない)。秒には小数点以下も付く。 |
2574 | 947 | .IP X |
2575 | 948 | 現在のロケールによる時刻表示 (H:M:S) |
2576 | | -.\"O .IP Z |
2577 | | -.\"O time zone (e.g., EDT), or nothing if no time zone is determinable |
2578 | | -.\"O .PP |
2579 | 949 | .IP Z |
2580 | 950 | タイムゾーン (JST など)。タイムゾーンを決定できない場合は、何も表示しない。 |
2581 | 951 | .PP |
2582 | | -.\"O Date fields: |
2583 | | -.\"O .IP a |
2584 | | -.\"O locale's abbreviated weekday name (Sun..Sat) |
2585 | 952 | 日付フィールド: |
2586 | 953 | .IP a |
2587 | 954 | 現在のロケールによる曜日の短縮形 (Sun..Sat) |
2588 | | -.\"O .IP A |
2589 | | -.\"O locale's full weekday name, variable length (Sunday..Saturday) |
2590 | 955 | .IP A |
2591 | | -現在のロケールによる曜日のフル表示。長さは可変 (Sunday..Saturday) |
2592 | | -.\"O .IP b |
2593 | | -.\"O locale's abbreviated month name (Jan..Dec) |
| 956 | +現在のロケールによる曜日の省略しない表示。長さは可変 (Sunday..Saturday) |
2594 | 957 | .IP b |
2595 | 958 | 現在のロケールによる月名の短縮形 (Jan..Dec) |
2596 | | -.\"O .IP B |
2597 | | -.\"O locale's full month name, variable length (January..December) |
2598 | 959 | .IP B |
2599 | | -現 在 のロケールによる月名のフル表示。長さは可変 (January..December) |
2600 | | -.\"O .IP c |
2601 | | -.\"O locale's date and time (Sat Nov 04 12:02:33 EST 1989). The format is |
2602 | | -.\"O the same as for |
2603 | | -.\"O .BR ctime (3) |
2604 | | -.\"O and so to preserve compatibility with that format, there is no fractional part |
2605 | | -.\"O in the seconds field. |
| 960 | +現在のロケールによる月名の省略しない表示。長さは可変 (January..December) |
2606 | 961 | .IP c |
2607 | 962 | 現在のロケールによる日付と時刻の表示 (Sat Nov 04 12:02:33 EST 1989)。 |
2608 | | -この表示形式は |
2609 | | -.BR ctime (3) |
2610 | | -のものと同じであり、 |
2611 | | -.BR ctime (3) |
| 963 | +この表示形式は \fBctime\fP(3) のものと同じであり、\fBctime\fP(3) |
2612 | 964 | の形式との互換性を維持するためにそうなっている。秒には小数点以下が付かない。 |
2613 | | -.\"O .IP d |
2614 | | -.\"O day of month (01..31) |
2615 | 965 | .IP d |
2616 | 966 | その月の何日目かの表示 (01..31) |
2617 | | -.\"O .IP D |
2618 | | -.\"O date (mm/dd/yy) |
2619 | 967 | .IP D |
2620 | 968 | 日付 (mm/dd/yy) |
2621 | | -.\"O .IP h |
2622 | | -.\"O same as b |
2623 | 969 | .IP h |
2624 | 970 | b と同じ |
2625 | | -.\"O .IP j |
2626 | | -.\"O day of year (001..366) |
2627 | 971 | .IP j |
2628 | 972 | その年の何日目かの表示 (001..366) |
2629 | | -.\"O .IP m |
2630 | | -.\"O month (01..12) |
2631 | 973 | .IP m |
2632 | 974 | 月 (01..12) |
2633 | | -.\"O .IP U |
2634 | | -.\"O week number of year with Sunday as first day of week (00..53) |
2635 | 975 | .IP U |
2636 | 976 | その年の何週目か (日曜日を週の始まりとする) (00..53) |
2637 | | -.\"O .IP w |
2638 | | -.\"O day of week (0..6) |
2639 | 977 | .IP w |
2640 | | -その週の何日目か (0..6) |
2641 | | -.\"O .IP W |
2642 | | -.\"O week number of year with Monday as first day of week (00..53) |
| 978 | +曜日 (0..6) |
2643 | 979 | .IP W |
2644 | 980 | その年の何週目か (月曜日を週の始まりとする) (00..53) |
2645 | | -.\"O .IP x |
2646 | | -.\"O locale's date representation (mm/dd/yy) |
2647 | 981 | .IP x |
2648 | 982 | 現在のロケールによる日付表示 (mm/dd/yy) |
2649 | | -.\"O .IP y |
2650 | | -.\"O last two digits of year (00..99) |
2651 | 983 | .IP y |
2652 | | -年の後ろ二桁 (00..99) |
2653 | | -.\"O .IP Y |
2654 | | -.\"O year (1970...) |
| 984 | +年の下二桁 (00..99) |
2655 | 985 | .IP Y |
2656 | 986 | 年 (1970...) |
2657 | | -.\"O .RE |
2658 | | -.\"O .IP %b |
2659 | | -.\"O The amount of disk space used for this file in 512-byte blocks. Since disk |
2660 | | -.\"O space is allocated in multiples of the filesystem block size this is usually |
2661 | | -.\"O greater than %s/512, but it can also be smaller if the file is a sparse file. |
2662 | 987 | .RE |
2663 | 988 | .IP %b |
2664 | | -ファイルのディスクスペース使用量を 1 ブロック 512 バイトのブロック数で |
2665 | | -表示する。割り当てられたディスクスペースは、ファイルシステムの |
2666 | | -ブロックサイズの倍数になるので、この表示はたいてい %s/512 より大きい。 |
2667 | | -だが、ファイルが穴空きファイル (sparse file) の場合は、%s/512 より |
2668 | | -小さくなることもある。 |
2669 | | -.\"O .IP %c |
2670 | | -.\"O File's last status change time in the format returned by the C `ctime' |
2671 | | -.\"O function. |
| 989 | +ファイルのディスクスペース使用量を 1 ブロック 512 バイトのブロック数で表示する。 |
| 990 | +ディスクスペースは、ファイルシステムのブロックサイズの倍数で割り当てられるので、この表示はたいてい |
| 991 | +%s/512 より大きい。だが、ファイルが穴空きファイル (sparse file) |
| 992 | +の場合は、%s/512 より小さくなることもある。 |
2672 | 993 | .IP %c |
2673 | | -ファイルの最終ステータス変更日時を C 言語の `ctime' 関数が返す |
2674 | | -形式で表示する。 |
2675 | | -.\"O .IP %C\fIk\fP |
2676 | | -.\"O File's last status change time in the format specified by \fIk\fR, |
2677 | | -.\"O which is the same as for %A. |
| 994 | +ファイルの最終ステータス変更日時を C 言語の `ctime' 関数が返す形式で表示する。 |
2678 | 995 | .IP %C\fIk\fP |
2679 | | -ファイルの最終ステータス変更日時を \fIk\fR で指定した書式で表示する。 |
2680 | | -\fIk\fR は %A の場合と同じである。 |
2681 | | -.\"O .IP %d |
2682 | | -.\"O File's depth in the directory tree; 0 means the file is a command line |
2683 | | -.\"O argument. |
| 996 | +ファイルの最終ステータス変更日時を \fIk\fP で指定した書式で表示する。 |
| 997 | +\fIk\fP は %A の場合と同じである。 |
2684 | 998 | .IP %d |
2685 | | -ファイルがディレクトリツリー中でどの深さにあるかを示す。0 だったら、 |
2686 | | -そのファイルがコマンドライン引き数であるということだ。 |
2687 | | -.\"O .IP %D |
2688 | | -.\"O The device number on which the file exists (the st_dev field of struct |
2689 | | -.\"O stat), in decimal. |
| 999 | +ファイルがディレクトリツリー中でどの深さにあるかを示す。 |
| 1000 | +0 だったら、そのファイルが探索開始点だということだ。 |
2690 | 1001 | .IP %D |
2691 | 1002 | ファイルがどのデバイス上にあるかを十進数のデバイス番号で示す |
2692 | 1003 | (stat 構造体の st_dev フィールドに当たる)。 |
2693 | | -.\"O .IP %f |
2694 | | -.\"O File's name with any leading directories removed (only the last element). |
2695 | 1004 | .IP %f |
2696 | | -先行するディレクトリをすべて取り去ったファイル名 (すなわち、 |
2697 | | -最後の要素のみ表示)。 |
2698 | | -.\"O .IP %F |
2699 | | -.\"O Type of the filesystem the file is on; this value can be used for |
2700 | | -.\"O \-fstype. |
| 1005 | +先行するディレクトリをすべて取り去ったファイル名 |
| 1006 | +(すなわち、最後の要素のみ表示)。 |
2701 | 1007 | .IP %F |
2702 | | -ファイルが置かれているファイルシステムのタイプ。 |
2703 | | -ここで表示された値は -fstype の引き数に指定することができる。 |
2704 | | -.\"O .IP %g |
2705 | | -.\"O File's group name, or numeric group ID if the group has no name. |
| 1008 | +ファイルが置かれているファイルシステムのタイプ。ここで表示された値は |
| 1009 | +\-fstype の引き数に指定することができる。 |
2706 | 1010 | .IP %g |
2707 | | -ファイルのグループ名。グループ名が登録されていない場合は、 |
2708 | | -グループ ID 番号。 |
2709 | | -.\"O .IP %G |
2710 | | -.\"O File's numeric group ID. |
| 1011 | +ファイルのグループ名。該当するグループ名が存在しない場合は、グループ ID 番号。 |
2711 | 1012 | .IP %G |
2712 | 1013 | ファイルのグループ ID 番号。 |
2713 | | -.\"O .IP %h |
2714 | | -.\"O Leading directories of file's name (all but the last element). |
2715 | | -.\"O If the file name contains no slashes (since it is in the current |
2716 | | -.\"O directory) the %h specifier expands to ".". |
2717 | 1014 | .IP %h |
2718 | | -ファイル名中の先行するディレクトリの部分 (すなわち、 |
2719 | | -最後の要素以外のすべて)。ファイル名にスラッシュが一つも含まれない場合は |
2720 | | -(ファイルがカレントディレクトリにあるからだ)、 |
2721 | | -%h 書式指定子は "." に展開される。 |
2722 | | -.\"O .IP %H |
2723 | | -.\"O Command line argument under which file was found. |
| 1015 | +ファイル名中の先行するディレクトリの部分 (すなわち、最後の要素以外のすべて)。 |
| 1016 | +ファイル名にスラッシュが一つも含まれない場合は |
| 1017 | +(それは、カレントディレクトリ中にあるということだから)、%h 書式指定子は |
| 1018 | +"." に展開される。 |
2724 | 1019 | .IP %H |
2725 | | -探索の開始点を示すコマンドライン引き数で、その下に問題のファイルが |
2726 | | -見つかったもの。 |
2727 | | -.\"O .IP %i |
2728 | | -.\"O File's inode number (in decimal). |
| 1020 | +探索開始点のうち、その下に問題のファイルが見つかったもの。 |
2729 | 1021 | .IP %i |
2730 | 1022 | ファイルの inode 番号 (十進数表示)。 |
2731 | | -.\"O .IP %k |
2732 | | -.\"O The amount of disk space used for this file in 1K blocks. Since disk space is |
2733 | | -.\"O allocated in multiples of the filesystem block size this is usually greater |
2734 | | -.\"O than %s/1024, but it can also be smaller if the file is a sparse file. |
2735 | 1023 | .IP %k |
2736 | | -ファイルのディスクスペース使用量を 1 ブロック 1 キロバイトのブロック数で |
2737 | | -表示する。割り当てられたディスクスペースは、ファイルシステムの |
2738 | | -ブロックサイズの倍数になるので、この表示はたいてい %s/1024 より大きい。 |
2739 | | -だが、ファイルが穴空きファイル (sparse file) の場合は、%s/1024 より |
2740 | | -小さくなることもある。 |
2741 | | -.\"O .IP %l |
2742 | | -.\"O Object of symbolic link (empty string if file is not a symbolic link). |
| 1024 | +ファイルのディスクスペース使用量を 1 ブロック 1 キロバイトのブロック数で表示する。 |
| 1025 | +ディスクスペースは、ファイルシステムのブロックサイズの倍数で割り当てられるので、この表示はたいてい %s/1024 より大きい。 |
| 1026 | +だが、ファイルが穴空きファイル (sparse file) の場合は、%s/1024 より小さくなることもある。 |
2743 | 1027 | .IP %l |
2744 | | -シンボリックリンクの参照先 (ファイルがシンボリックリンクでなかったら、 |
2745 | | -空文字列)。 |
2746 | | -.\"O .IP %m |
2747 | | -.\"O File's permission bits (in octal). This option uses the `traditional' |
2748 | | -.\"O numbers which most Unix implementations use, but if your particular |
2749 | | -.\"O implementation uses an unusual ordering of octal permissions bits, you |
2750 | | -.\"O will see a difference between the actual value of the file's mode and |
2751 | | -.\"O the output of %m. Normally you will want to have a leading |
2752 | | -.\"O zero on this number, and to do this, you should use the |
2753 | | -.\"O .B # |
2754 | | -.\"O flag (as in, for example, `%#m'). |
| 1028 | +シンボリックリンクの参照先 (ファイルがシンボリックリンクでなかったら、空文字列)。 |
2755 | 1029 | .IP %m |
2756 | | -ファイルの許可属性ビット (8 進数表示)。このオプションが使用している |
2757 | | -数値は、Unix のたいていの実装が使用している「伝統的な」数値である。 |
2758 | | -しかし、ご使用のシステムの実装では、8 進数で表示する許可属性ビットの並び方が |
2759 | | -独特かもしれない。その場合は、ファイルの許可属性の実際の値と |
2760 | | -%m の出力とが、相違することになる。この数値の先頭に 0 を付けて |
2761 | | -表示したいこともよくあるが、そのためには、 |
2762 | | -.B # |
2763 | | -フラグを使用すればよい (たとえば、`%#m' といった具合に)。 |
2764 | | -.\"O .IP %M |
2765 | | -.\"O File's permissions (in symbolic form, as for |
2766 | | -.\"O .BR ls ). |
2767 | | -.\"O This directive is supported in findutils 4.2.5 and later. |
| 1030 | +ファイルの許可属性ビット (8 進数表示)。このオプションが使用している数値は、 |
| 1031 | +Unix のたいていの実装が使用している「伝統的な」数値である。 |
| 1032 | +しかし、ご使用のシステムの実装では、8 進数で表示する許可属性ビットの並び方が独特かもしれない。 |
| 1033 | +その場合は、ファイルの許可属性の実際の値と %m の出力とが、相違することになる。 |
| 1034 | +この数値の先頭に 0 を付けて表示したいこともよくあるが、 |
| 1035 | +そのためには、\fB#\fP フラグを使用すればよい (たとえば、`%#m' といった具合に)。 |
2768 | 1036 | .IP %M |
2769 | | -ファイルの許可属性 |
2770 | | -.RB ( ls |
2771 | | -と同様のシンボルによる表現)。この書式指定子は findutils 4.2.5 以来 |
2772 | | -サポートされている。 |
2773 | | -.\"O .IP %n |
2774 | | -.\"O Number of hard links to file. |
| 1037 | +ファイルの許可属性 (\fBls\fP と同様のシンボルによる表現)。この書式指定子は findutils 4.2.5 以来 サポートされている。 |
2775 | 1038 | .IP %n |
2776 | 1039 | ファイルのハードリンク数。 |
2777 | | -.\"O .IP %p |
2778 | | -.\"O File's name. |
2779 | 1040 | .IP %p |
2780 | 1041 | ファイル名。 |
2781 | | -.\"O .IP %P |
2782 | | -.\"O File's name with the name of the command line argument under which |
2783 | | -.\"O it was found removed. |
2784 | 1042 | .IP %P |
2785 | | -問題のファイルが、ある探索開始点の下にあった場合に、ファイル名から |
2786 | | -探索開始点を示すコマンドライン引き数の部分を取り去ったもの。 |
2787 | | -.\"O .IP %s |
2788 | | -.\"O File's size in bytes. |
| 1043 | +問題のファイルが、ある探索開始点の下にあった場合に、 |
| 1044 | +ファイル名から探索開始点を示す部分を取り去ったもの。 |
2789 | 1045 | .IP %s |
2790 | 1046 | バイトで表示したファイルサイズ。 |
2791 | | -.\"O .IP %S |
2792 | | -.\"O File's sparseness. This is calculated as (BLOCKSIZE*st_blocks / |
2793 | | -.\"O st_size). The exact value you will get for an ordinary file of a |
2794 | | -.\"O certain length is system-dependent. However, normally sparse files |
2795 | | -.\"O will have values less than 1.0, and files which use indirect blocks |
2796 | | -.\"O may have a value which is greater than 1.0. The value used for |
2797 | | -.\"O BLOCKSIZE is system-dependent, but is usually 512 bytes. If the file |
2798 | | -.\"O size is zero, the value printed is undefined. On systems which lack |
2799 | | -.\"O support for st_blocks, a file's sparseness is assumed to be 1.0. |
2800 | 1047 | .IP %S |
2801 | | -ファイルの穴空き率 (sparseness)。この値は、(BLOCKSIZE*st_blocks / st_size) で |
2802 | | -計算される。ある大きさの普通のファイルから得られる値は、 |
2803 | | -厳密に言うと、システム依存である。それでも、 |
2804 | | -穴空きファイルの穴空き率は、通常 1.0 未満になるし、間接ブロックを |
2805 | | -使用しているファイルの穴空き率は、1.0 以上になることがある。 |
| 1048 | +ファイルの穴空き率 (sparseness)。この値は、(BLOCKSIZE*st_blocks / st_size) |
| 1049 | +で計算される。ある大きさの普通のファイルから得られる値は、厳密に言うと、システム依存である。 |
| 1050 | +それでも、穴空きファイルの穴空き率は、通常 1.0 未満になるし、 |
| 1051 | +間接ブロックを使用しているファイルの穴空き率は、1.0 以上になることがある。 |
2806 | 1052 | BLOCKSIZE に使われる値は、システム次第だが、普通は 512 バイトである。 |
2807 | 1053 | ファイルサイズが 0 の場合、出力される値は不定である。 |
2808 | | -st_blocks をサポートしていないシステムでは、ファイルの穴空き率は、 |
2809 | | -1.0 と見なされる。 |
2810 | | -.\"O .IP %t |
2811 | | -.\"O File's last modification time in the format returned by the C `ctime' |
2812 | | -.\"O function. |
| 1054 | +st_blocks をサポートしていないシステムでは、ファイルの穴空き率は、1.0 と見なされる。 |
2813 | 1055 | .IP %t |
2814 | 1056 | ファイルの最終内容更新日時を、C 言語の `ctime' 関数が返す形式で表示する。 |
2815 | | -.\"O .IP %T\fIk\fP |
2816 | | -.\"O File's last modification time in the format specified by \fIk\fR, |
2817 | | -.\"O which is the same as for %A. |
2818 | 1057 | .IP %T\fIk\fP |
2819 | | -ファイルの最終内容更新日時を、\fIk\fR で指定した書式で表示する。 |
2820 | | -\fIk\fR は %A の場合と同じである。 |
2821 | | -.\"O .IP %u |
2822 | | -.\"O File's user name, or numeric user ID if the user has no name. |
| 1058 | +ファイルの最終内容更新日時を \fIk\fP で指定した書式で表示する。 |
| 1059 | +\fIk\fP は %A の場合と同じである。 |
2823 | 1060 | .IP %u |
2824 | | -ファイルの所有者名。所有者のユーザが登録されていない場合は、ユーザ ID 番号。 |
2825 | | -.\"O .IP %U |
2826 | | -.\"O File's numeric user ID. |
| 1061 | +ファイルの所有者名。該当するユーザ名が存在しない場合は、ユーザ ID 番号。 |
2827 | 1062 | .IP %U |
2828 | 1063 | ファイルのユーザ ID 番号。 |
2829 | | -.\"O .IP %y |
2830 | | -.\"O File's type (like in |
2831 | | -.\"O .BR "ls \-l" ), |
2832 | | -.\"O U=unknown type (shouldn't happen) |
2833 | 1064 | .IP %y |
2834 | | -ファイルのタイプ |
2835 | | -.RB ( "ls \-l" |
2836 | | -の表現とほぼ同じ)。U=unknown type (これが表示されることはないはずだ) |
2837 | | -.\"O .IP %Y |
2838 | | -.\"O File's type (like %y), plus follow symlinks: L=loop, N=nonexistent |
2839 | | -.\"O .PP |
| 1065 | +ファイルのタイプ (\fBls \-l\fP の表現とほぼ同じ)。U=unknown type |
| 1066 | +(これが表示されることはないはずだ) |
2840 | 1067 | .IP %Y |
2841 | 1068 | ファイルのタイプ (表示は %y と同じ)。ただし、シンボリックリンクをたどる。 |
2842 | 1069 | その場合、L=loop, N=nonexistent である。 |
| 1070 | +.IP %Z |
| 1071 | +(SELinux が有効なときのみ) ファイルのセキュリティ・コンテクスト。 |
| 1072 | +.IP "%{ %[ %(" |
| 1073 | +将来の使用のために予約されている。 |
2843 | 1074 | .PP |
2844 | | -.\"O A `%' character followed by any other character is discarded, but the |
2845 | | -.\"O other character is printed (don't rely on this, as further format |
2846 | | -.\"O characters may be introduced). A `%' at the end of the format |
2847 | | -.\"O argument causes undefined behaviour since there is no following |
2848 | | -.\"O character. In some locales, it may hide your door keys, while in |
2849 | | -.\"O others it may remove the final page from the novel you are reading. |
2850 | | -.\"O |
2851 | | -一個の `%' に上記以外の文字が続く場合、`%' 文字は捨てられるが、 |
2852 | | -それに続く文字は表示される (書式指定文字が新たに追加されるかもしれないので、 |
2853 | | -この動作を当てにしてはいけない)。書式指定の末尾に `%' があるときの動作は、 |
2854 | | -続く文字がないので不定である。ロケールによっては、お宅のドアの鍵が |
2855 | | -見つからなくなるかもしれない。また、別のロケールでは、 |
2856 | | -お読みの小説の最後のページが消えてしまうかもしれない。 |
2857 | | - |
2858 | | -.\"O The %m and %d directives support the |
2859 | | -.\"O .B # |
2860 | | -.\"O , |
2861 | | -.\"O .B 0 |
2862 | | -.\"O and |
2863 | | -.\"O .B + |
2864 | | -.\"O flags, but the other directives do not, even if they |
2865 | | -.\"O print numbers. Numeric directives that do not support these flags |
2866 | | -.\"O include |
2867 | | -.\"O .BR G , |
2868 | | -.\"O .BR U , |
2869 | | -.\"O .BR b , |
2870 | | -.\"O .BR D , |
2871 | | -.\"O .B k |
2872 | | -.\"O and |
2873 | | -.\"O .BR n . |
2874 | | -.\"O The `\-' format flag is supported and changes the alignment of a field |
2875 | | -.\"O from right-justified (which is the default) to left-justified. |
2876 | | -.\"O .PP |
2877 | | -書式指定子 %m と %d はフラグ |
2878 | | -.BR # , |
2879 | | -.BR 0 , |
2880 | | -.B + |
2881 | | -をサポートするが、それ以外の書式指定子は、数値を表示する場合でも、 |
2882 | | -そうしたフラグをサポートしない。 |
2883 | | -.B # |
2884 | | -などをサポートしない数値関係の書式指定子には、 |
2885 | | -.BR G , |
2886 | | -.BR U , |
2887 | | -.BR b , |
2888 | | -.BR D , |
2889 | | -.BR k , |
2890 | | -.B n |
2891 | | -などがある。しかし、書式フラグ `\-' はサポートされており、フィールドを |
| 1075 | +一個の `%' に上記以外の文字が続く場合、`%' 文字は捨てられるが、それに続く文字は表示される |
| 1076 | +(書式指定文字が新たに追加されるかもしれないので、この動作を当てにしてはいけない。 |
| 1077 | +(訳注: 以前はそのとおりだったが、現在では、無効な書式指定子を使った場合、`%q' |
| 1078 | +のように `%' も表示されるようだ))。 |
| 1079 | +書式指定の末尾に `%' があるときの動作は、続く文字がないので不定である。 |
| 1080 | +ロケールによっては、お宅のドアの鍵が見つからなくなるかもしれない。 |
| 1081 | +また、別のロケールでは、お読みになっている小説の最後のページが消えてしまうかもしれない。 |
| 1082 | + |
| 1083 | +書式指定子 %m と %d はフラグ \fB#\fP, \fB0\fP, \fB+\fP をサポートするが、 |
| 1084 | +それ以外の書式指定子では、数値を表示する場合でも、そうしたフラグをサポートしない。 |
| 1085 | +\fB#\fP などをサポートしない数値関係の書式指定子には、\fBG\fP, \fBU\fP, \fBb\fP, \fBD\fP, |
| 1086 | +\fBk\fP, \fBn\fP などがある。しかし、書式フラグ `\-' はサポートされており、フィールドを |
2892 | 1087 | (デフォルトの) 右揃えから左揃えに変更する。 |
2893 | 1088 | .PP |
2894 | | -.\"O See the |
2895 | | -.\"O .B UNUSUAL FILENAMES |
2896 | | -.\"O section for information about how unusual characters in filenames are handled. |
2897 | | -.\"O |
2898 | | -.\"O |
2899 | | -.\"O .RE |
2900 | | -ファイル名中の変わった文字がどのように扱われるかについては、 |
2901 | | -「変わり者のファイル名」セクションの説明を参照してほしい。 |
| 1089 | +ファイル名中の普通使わない文字がどのように扱われるかについては、 |
| 1090 | +「変わり者のファイル名」セクションの説明を参照していただきたい。 |
2902 | 1091 | |
2903 | 1092 | |
2904 | 1093 | .RE |
2905 | | -.\"O .IP \-prune |
2906 | | -.\"O True; if the file is a directory, do not descend into it. If |
2907 | | -.\"O .B \-depth |
2908 | | -.\"O is given, false; no effect. Because |
2909 | | -.\"O .B \-delete |
2910 | | -.\"O implies |
2911 | | -.\"O .BR \-depth , |
2912 | | -.\"O you cannot usefully use |
2913 | | -.\"O .B \-prune |
2914 | | -.\"O and |
2915 | | -.\"O .B \-delete together. |
2916 | | -.\"O |
2917 | 1094 | .IP \-prune |
2918 | | -真を返す。ファイルがディレクトリの場合は、そのディレクトリ以下に |
2919 | | -降りて行かない。 |
2920 | | -.B \-depth |
2921 | | -が指定してあるときは、偽を返し、何もしない。 |
2922 | | -.B \-delete |
2923 | | -を指定すると自動的に |
2924 | | -.B \-depth |
2925 | | -が有効になるので、 |
2926 | | -.B \-prune |
2927 | | -を |
2928 | | -.B \-delete |
2929 | | -と一緒に使っても役に立たない。 |
| 1095 | +真を返す。処理対象のファイルがディレクトリの場合は、そのディレクトリ以下に降りて行かない。 |
| 1096 | +\fB\-depth\fP が指定してあると、\fB\-prune\fP は、 |
| 1097 | +偽を返し、その効果を失う。\fB\-delete\fP を指定すると自動的に \fB\-depth\fP |
| 1098 | +が有効になるので、\fB\-prune\fP を \fB\-delete\fP と一緒に使っても役に立たない。 |
| 1099 | + |
2930 | 1100 | .RS |
2931 | | -.IP "[訳注]:" 8 |
2932 | | -バージョン 4.4.0 以降の \fBfind\fR では、\fB\-prune\fR の動作が |
2933 | | -上記の説明と少し異なっている。すなわち、「\fB\-depth\fR が指定して |
2934 | | -あるときは、何もしない」のは、それまでのバージョンと同じだが、 |
2935 | | -返り値は真を返している。ご自分で、 |
| 1101 | +.IP "[\fB訳注\fP]:" 8 |
| 1102 | +つまり、\fB\-prune\fR は指定されたディレクトリの、いわゆる枝刈り |
| 1103 | +(prune) をする。バージョン 4.3.11 以降の \fBfind\fR では、\fB\-prune\fR |
| 1104 | +の動作が、上の説明と少し違っている。\fB\-depth\fR |
| 1105 | +が指定してあると、\fB\-prune\fR が効果を失う (すなわち、枝刈りを行わなくなる) |
| 1106 | +ことは、それ以前と変わりがないが、\fI返り値は真を返すようになっているのだ\fR。 |
| 1107 | +これは POSIX 準拠の動作である。ご自分で、 |
2936 | 1108 | .B find . \-depth \-path \(dq./foo\(dq \-prune \-print |
2937 | | -などを実行して、確認していただきたい。\fB\-prune\fR が真を返していれば、 |
2938 | | -ディレクトリ \fB./foo\fR が表示されるはずだ。 |
| 1109 | +などを実行して、確認していただきたい。\fB\-prune\fR |
| 1110 | +が真を返していれば、ディレクトリ \fB./foo\fR が表示されるはずである。 |
2939 | 1111 | .RE |
| 1112 | +.IP \-quit |
| 1113 | +直ちに終了する。動いている子プロセスを残したまま終了したりはしないが、コマンドラインで指定したパスをこれ以上処理することはない。 |
| 1114 | +たとえば、 \fBfind /tmp/foo /tmp/bar \-print \-quit\fP は、\fB/tmp/foo\fP を表示するだけである。 |
| 1115 | +\fB\-execdir \&...\& {} +\fP によってすでに作成されたコマンドラインがあれば、 |
| 1116 | +\fBfind\fP が終了する前に、呼び出して実行する。 |
| 1117 | +終了ステータスは、 エラーがすでに起きているかどうかよって、0 のことも、0 でないこともある。 |
2940 | 1118 | |
2941 | | -.\"O .IP "\-quit" |
2942 | | -.\"O Exit immediately. No child processes will be left running, but no more |
2943 | | -.\"O paths specified on the command line will be processed. For example, |
2944 | | -.\"O .B find /tmp/foo /tmp/bar \-print \-quit |
2945 | | -.\"O will print only |
2946 | | -.\"O .BR /tmp/foo . |
2947 | | -.\"O Any command lines which have been built up with |
2948 | | -.\"O .B \-execdir ... {} + |
2949 | | -.\"O will be invoked before |
2950 | | -.\"O .B find |
2951 | | -.\"O exits. The exit status may or may not be zero, depending on whether |
2952 | | -.\"O an error has already occurred. |
2953 | | -.\"O |
2954 | | -.IP "\-quit" |
2955 | | -直ちに終了する。動いている子プロセスを残したまま終了したりはしないが、 |
2956 | | -コマンドラインで指定したパスをこれ以上処理することはない。たとえば、 |
2957 | | -.B find /tmp/foo /tmp/bar \-print \-quit |
2958 | | -は、 |
2959 | | -.B /tmp/foo |
2960 | | -を表示するだけである。 |
2961 | | -.B \-execdir ... {} + |
2962 | | -によってすでに作成されたコマンドラインがあれば、 |
2963 | | -.B find |
2964 | | -が終了する前に、呼び出して実行する。終了ステータスは、 |
2965 | | -エラーがすでに起きているかどうかよって、0 のことも、0 でないこともある。 |
2966 | | - |
2967 | | -.\"O .SS UNUSUAL FILENAMES |
2968 | | -.\"O Many of the actions of |
2969 | | -.\"O .B find |
2970 | | -.\"O result in the printing of data which is under the control of other |
2971 | | -.\"O users. This includes file names, sizes, modification times and so |
2972 | | -.\"O forth. File names are a potential problem since they can contain any |
2973 | | -.\"O character except `\e0' and `/'. Unusual characters in file names can |
2974 | | -.\"O do unexpected and often undesirable things to your terminal (for |
2975 | | -.\"O example, changing the settings of your function keys on some |
2976 | | -.\"O terminals). Unusual characters are handled differently by various |
2977 | | -.\"O actions, as described below. |
2978 | | -.\"O |
2979 | | -.SS 変わり者のファイル名 |
2980 | | -多くの場合、 |
| 1119 | +.SS 演算子 |
| 1120 | +.P |
| 1121 | +演算子を優先順位の高いものから順に列挙する。 |
| 1122 | + |
| 1123 | +.IP "( \fIexpr\fP )" |
| 1124 | +カッコの内側を先に処理する。カッコはシェルにとって特別な意味を持っているので、普通はクォートする必要があるだろう。 |
| 1125 | +このマニュアルページで挙げている例の多くでは、そのためにバックスラッシュを使っている。 |
| 1126 | +すなわち `(...)' ではなく、`\e(...\e)' と書いている。 |
| 1127 | + |
| 1128 | +.IP "! \fIexpr\fP" |
| 1129 | +\fIexpr\fP が偽の場合、真になる。 |
| 1130 | +通常、この記号もシェルによって解釈されないようにする必要があるだろう。 |
| 1131 | + |
| 1132 | +.IP "\-not \fIexpr\fP" |
| 1133 | +! \fIexpr\fP と同じだが、POSIX 準拠の表現ではない。 |
| 1134 | + |
| 1135 | +.IP "\fIexpr1 expr2\fP" |
| 1136 | +連続する二つの式は、and 結合と解釈される (明示されていないが、式の間に |
| 1137 | +"\-a" があると見なされるわけだ)。\fIexpr1\fP が偽の場合、\fIexpr2\fP は評価されない。 |
| 1138 | + |
| 1139 | +.IP "\fIexpr1\fP \-a \fIexpr2\fP" |
| 1140 | +\fIexpr1 expr2\fP と同じ。 |
| 1141 | + |
| 1142 | +.IP "\fIexpr1\fP \-and \fIexpr2\fP" |
| 1143 | +\fIexpr1 expr2\fP と同じだが、POSIX 準拠の表現ではない。 |
| 1144 | + |
| 1145 | +.IP "\fIexpr1\fP \-o \fIexpr2\fP" |
| 1146 | +or 結合である。\fIexpr1\fP が真ならば、\fIexpr2\fP は評価されない。 |
| 1147 | + |
| 1148 | +.IP "\fIexpr1\fP \-or \fIexpr2\fP" |
| 1149 | +\fIexpr1\fP \fB\-o\fP \fIexpr2\fP と同じだが、POSIX 準拠の表現ではない。 |
| 1150 | + |
| 1151 | +.IP "\fIexpr1\fP , \fIexpr2\fP" |
| 1152 | +リストである。常に \fIexpr1\fP と \fIexpr2\fP の両方が評価される。 |
| 1153 | +\fIexpr1\fP の値は捨てられ、\fIexpr2\fP の値がリスト全体の値になる。 |
| 1154 | +コンマ演算子はいくつかの異なったタイプの対象を捜すとき便利だが、ファイルシステム階層の探索は一度しか行われない。 |
| 1155 | +異なった形でマッチした対象の一覧をそれぞれ別の出力ファイルに書き出すには、\fB\-fprintf\fP アクションを利用すればよい。 |
| 1156 | + |
| 1157 | + |
| 1158 | +.IP "[\fB訳注\fR]:" 8 |
2981 | 1159 | .B find |
2982 | | -のアクションはデータを端末に表示することになるわけだが、それは |
2983 | | -ほかのユーザが自由にできるデータであることもある。そうしたデータとは、 |
2984 | | -たとえば、ファイルの名前、サイズ、内容更新日時などだ。 |
2985 | | -この内、ファイル名は `\e0' と `/' 以外のどんな文字でも使えることに |
2986 | | -なっているので、時として問題の種となる。ファイル名の中に |
2987 | | -風変わりな文字があると、使用している端末に思いがけない、 |
2988 | | -そしてしばしば望ましくない影響をもたらすことがあるのだ (たとえば、 |
| 1160 | +にとって演算子も引き数である。だから `(', `)', `!', `,' といった演算子も、 |
| 1161 | +前後の引き数との間に空白が必要だということに気をつけていただきたい。 |
| 1162 | +.SH 変わり者のファイル名 |
| 1163 | +多くの場合 \fBfind\fP のアクションは、他のユーザが自由にできるデータを端末に表示することになる。 |
| 1164 | +そうしたデータには、 たとえば、ファイルの名前、サイズ、内容更新日時などがある。 |
| 1165 | +この内、ファイル名は `\e0' と `/' 以外のどんな文字でも使えることになっているので、時として問題の種となる。 |
| 1166 | +ファイル名の中に普通は使わない文字があると、使用している端末に思いがけない、そしてしばしば望ましくない影響をもたらすことがあるのだ (たとえば、 |
2989 | 1167 | 端末によっては、ファンクション・キーの現在の設定が変更されてしまう)。 |
2990 | | -風変わりな文字をどう扱うかはアクションによって異なっている。 |
2991 | | -それを以下に示そう。 |
2992 | | - |
2993 | | -.\"O .IP "\-print0, \-fprint0\" |
2994 | | -.\"O Always print the exact filename, unchanged, even if the output is |
2995 | | -.\"O going to a terminal. |
2996 | | -.\"O |
2997 | | -.IP "\-print0, \-fprint0\" |
2998 | | -常にファイル名に手を加えず、そのまま出力する。出力先が端末であっても、 |
2999 | | -同じである。 |
3000 | | - |
3001 | | -.\"O .IP "\-ls, \-fls" |
3002 | | -.\"O Unusual characters are always escaped. White space, backslash, and |
3003 | | -.\"O double quote characters are printed using C-style escaping (for |
3004 | | -.\"O example `\ef', `\e"'). Other unusual characters are printed using an |
3005 | | -.\"O octal escape. Other printable characters (for |
3006 | | -.\"O .B \-ls |
3007 | | -.\"O and |
3008 | | -.\"O .B \-fls |
3009 | | -.\"O these are the characters between octal 041 and 0176) are printed as-is. |
3010 | | -.\"O |
| 1168 | +普通使わない文字をどう扱うかはアクションによって異なっている。それを以下に示そう。 |
| 1169 | + |
| 1170 | +.IP "\-print0, \-fprint0" |
| 1171 | +常にファイル名に手を加えず、そのまま出力する。出力先が端末であっても、同じである。 |
| 1172 | + |
3011 | 1173 | .IP "\-ls, \-fls" |
3012 | | -風変わりな文字は、常にエスケープされる。ホワイトスペース (空白、 |
3013 | | -改行、タブなど)、バックスラッシュ、ダブルクォートは C 言語式の |
3014 | | -エスケープ表現で出力される (たとえば `\ef', `\e"')。 |
3015 | | -ほかの風変わりな文字には、エスケープした8 進数が使われる。 |
3016 | | -それ以外の表示可能な文字は |
3017 | | -.RB ( \-ls |
3018 | | -や |
3019 | | -.B \-fls |
3020 | | -とっては 8 進数の 041 から 0176 に当たる文字)、手を加えずに |
3021 | | -そのまま出力される。 |
3022 | | - |
3023 | | -.\"O .IP "\-printf, \-fprintf" |
3024 | | -.\"O If the output is not going to a terminal, it is printed as-is. |
3025 | | -.\"O Otherwise, the result depends on which directive is in use. The |
3026 | | -.\"O directives %D, %F, %g, %G, %H, %Y, and %y expand to values which are |
3027 | | -.\"O not under control of files' owners, and so are printed as-is. The |
3028 | | -.\"O directives %a, %b, %c, %d, %i, %k, %m, %M, %n, %s, %t, %u and %U have |
3029 | | -.\"O values which are under the control of files' owners but which cannot |
3030 | | -.\"O be used to send arbitrary data to the terminal, and so these are |
3031 | | -.\"O printed as-is. The directives %f, %h, %l, %p and %P are quoted. This |
3032 | | -.\"O quoting is performed in the same way as for GNU |
3033 | | -.\"O .BR ls . |
3034 | | -.\"O This is not the same quoting mechanism as the one used for |
3035 | | -.\"O .B \-ls |
3036 | | -.\"O and |
3037 | | -.\"O .BR \-fls . |
| 1174 | +普通使わない文字は、常にエスケープされる。ホワイトスペース |
| 1175 | +(空白、改行、タブなど)、バックスラッシュ、ダブルクォートは C 言語式のエスケープ表現で出力される |
| 1176 | +(たとえば `\ef', `\e"')。他の普通使わない文字には、エスケープした 8 進数が使われる。 |
| 1177 | +それ以外の表示可能な文字は (\fB\-ls\fP や \fB\-fls\fP とっては 8 進数の |
| 1178 | +041 から 0176 に当たる文字)、手を加えずにそのまま出力される。 |
| 1179 | + |
3038 | 1180 | .IP "\-printf, \-fprintf" |
3039 | | -出力先が端末でない場合は、そのまま出力される。端末の場合は、 |
3040 | | -使用される書式指定子によって、結果は様々である。 |
3041 | | -書式指定子 %D, %F, %g, %G, %H, %Y, %y が展開される値は、 |
3042 | | -ファイルの所有者の管轄外なので、そのまま出力される。 |
3043 | | -書式指定子 %a, %b, %c, %d, %i, %k, %m, %M, %n, %s, %t, %u, %U の |
3044 | | -値は、ファイル所有者の管轄内であるが、それを使って端末に勝手なデータを |
3045 | | -送ることはできない。従って、そのまま出力される。 |
3046 | | -書式指定子 %f, %h, %l, %p, %P はクォートされる。このクォート方法は、GNU |
3047 | | -.B ls |
3048 | | -と同じである。言い換えると、 |
3049 | | -.B \-ls |
3050 | | -や |
3051 | | -.B \-fls |
3052 | | -におけるクォート方法とは違うということだ。 |
3053 | | -.\"O If you are able to decide what format to use for the output of |
3054 | | -.\"O .B find |
3055 | | -.\"O then it is normally better to use `\e0' as a terminator |
3056 | | -.\"O than to use newline, as file names can contain white space and newline |
3057 | | -.\"O characters. The setting of the `LC_CTYPE' environment |
3058 | | -.\"O variable is used to determine which characters need to be quoted. |
3059 | | -.\"O |
3060 | | -もし、 |
3061 | | -.B find |
3062 | | -の出力に使う形式を自由に決めることができるならば、たいていの場合、 |
| 1181 | +出力先が端末でない場合は、そのまま出力される。端末の場合は、使用される書式指定子によって、結果は様々である。 |
| 1182 | +書式指定子 %D, %F, %g, %G, %H, %Y, %y が展開される値は、ファイルの所有者の管轄外なので、そのまま出力される。 |
| 1183 | +書式指定子 %a, %b, %c, %d, %i, %k, %m, %M, %n, %s, %t, %u, %U |
| 1184 | +の値は、ファイル所有者の管轄内ではあるが、それを使って端末に勝手なデータを送ることはできない。 |
| 1185 | +従って、そのまま出力される。書式指定子 %f, %h, %l, %p, %P はクォートされる。 |
| 1186 | +このクォート方法は、GNU \fBls\fP と同じである (訳注: 厳密に言うと、現在のところ |
| 1187 | +\fBls \-N\fP と同じ。\fBls\fP はバージョンによっては、デフォルトの表示が \fB\-N\fP |
| 1188 | +ではないことがある)。つまり、\fB\-ls\fP や \fB\-fls\fP |
| 1189 | +におけるクォート方法とは違うということだ。もし、\fBfind\fP |
| 1190 | +の出力に使用する形式を自由に決めることができるならば、たいていの場合、 |
3063 | 1191 | 終端文字に改行ではなく、`\e0' を使用した方がよい。 |
3064 | 1192 | ファイル名には空白や改行が含まれていることがあるからだ。 |
3065 | | -どの文字がクォートを必要とするかを判断するには、環境変数 `LC_CTYPE' の設定が |
3066 | | -使用される。 |
3067 | | - |
3068 | | -.\"O .IP "\-print, \-fprint" |
3069 | | -.\"O Quoting is handled in the same way as for |
3070 | | -.\"O .B \-printf |
3071 | | -.\"O and |
3072 | | -.\"O .BR \-fprintf . |
3073 | | -.\"O If you are using |
3074 | | -.\"O .B find |
3075 | | -.\"O in a script or in a situation where the matched files might have |
3076 | | -.\"O arbitrary names, you should consider using |
3077 | | -.\"O .B \-print0 |
3078 | | -.\"O instead of |
3079 | | -.\"O .BR \-print . |
3080 | | -.\"O .P |
| 1193 | +どの文字にクォートが必要かを判断するには、環境変数 `LC_CTYPE' の設定が使用される。 |
| 1194 | + |
3081 | 1195 | .IP "\-print, \-fprint" |
3082 | | -クォートは |
3083 | | -.B \-printf |
3084 | | -や |
3085 | | -.B \-fprintf |
3086 | | -と同じやり方で行われる。 |
3087 | | -.B find |
3088 | | -をスクリプト中で使っている場合や、マッチするファイルが行儀の悪い |
3089 | | -ファイル名を持っている可能性がある場合は、 |
3090 | | -.B \-print |
3091 | | -ではなく、 |
3092 | | -.B \-print0 |
3093 | | -の使用を考えた方がよいだろう。 |
3094 | | -.P |
3095 | | -.\"O The |
3096 | | -.\"O .B \-ok |
3097 | | -.\"O and |
3098 | | -.\"O .B \-okdir |
3099 | | -.\"O actions print the current filename as-is. This may change in a future release. |
3100 | | -.\"O |
3101 | | -アクション |
3102 | | -.B \-ok |
3103 | | -と |
3104 | | -.B \-okdir |
3105 | | -は、対象となるファイル名をそのまま手を加えずに出力する。この動作は、 |
3106 | | -将来のリリースで変わるかもしれない。 |
3107 | | - |
3108 | | -.\"O .SS OPERATORS |
3109 | | -.\"O .P |
3110 | | -.\"O Listed in order of decreasing precedence: |
3111 | | -.\"O |
3112 | | -.SS 演算子 |
| 1196 | +クォートは \fB\-printf\fP や \fB\-fprintf\fP と同じやり方で行われる。 |
| 1197 | +\fBfind\fP をスクリプト中で使っている場合や、マッチするファイルが我儘なファイル名を持っているかもしれない場合は、\fB\-print\fP ではなく、 |
| 1198 | +\fB\-print0\fP の使用を考えた方がよいだろう。 |
3113 | 1199 | .P |
3114 | | -演算子を優先順位の高いものから順に列挙する。 |
| 1200 | +アクション \fB\-ok\fP と \fB\-okdir\fP は、対象となるファイル名をそのまま手を加えずに出力する。 |
| 1201 | +この動作は、将来のリリースで変わるかもしれない。 |
3115 | 1202 | |
3116 | | -.\"O .IP "( \fIexpr\fR )" |
3117 | | -.\"O Force precedence. Since parentheses are special to the shell, you |
3118 | | -.\"O will normally need to quote them. Many of the examples in this manual |
3119 | | -.\"O page use backslashes for this purpose: `\e(...\e)' instead of `(...)'. |
3120 | | -.\"O |
3121 | | -.IP "( \fIexpr\fR )" |
3122 | | -カッコの内側を先に処理する。カッコはシェルにとって特別な意味を |
3123 | | -持っているので、普通はクォートする必要があるだろう。 |
3124 | | -このマニュアルページで挙げている例の多くでは、そのためにバックスラッシュを |
3125 | | -使っている。すなわち `(...)' ではなく、`\e(...\e)' と書いているわけだ。 |
3126 | | - |
3127 | | -.\"O .IP "! \fIexpr\fR" |
3128 | | -.\"O True if \fIexpr\fR is false. This character will also usually need |
3129 | | -.\"O protection from interpretation by the shell. |
3130 | | -.\"O |
3131 | | -.IP "! \fIexpr\fR" |
3132 | | -\fIexpr\fR が偽の場合、真になる。通常この記号も、シェルによって |
3133 | | -解釈されないようにする必要があるだろう。 |
3134 | | - |
3135 | | -.\"O .IP "\-not \fIexpr\fR" |
3136 | | -.\"O Same as ! \fIexpr\fR, but not POSIX compliant. |
3137 | | -.\"O |
3138 | | -.IP "\-not \fIexpr\fR" |
3139 | | -! \fIexpr\fR と同じだが、POSIX 準拠の表現ではない。 |
3140 | | - |
3141 | | -.\"O .IP "\fIexpr1 expr2\fR" |
3142 | | -.\"O Two expressions in a row are taken to be joined with an |
3143 | | -.\"O implied "and"; \fIexpr2\fR is not evaluated if \fIexpr1\fR is false. |
3144 | | -.\"O |
3145 | | -.IP "\fIexpr1 expr2\fR" |
3146 | | -連続する二つの式は、and 結合と解釈される (明示されていないが、 |
3147 | | -式の間に "-a" があると見なされるわけだ)。\fIexpr1\fR が偽の場合、 |
3148 | | -\fIexpr2\fR は評価されない。 |
3149 | | - |
3150 | | -.\"O .IP "\fIexpr1\fR \-a \fIexpr2\fR" |
3151 | | -.\"O Same as \fIexpr1 expr2\fR. |
3152 | | -.\"O |
3153 | | -.IP "\fIexpr1\fR \-a \fIexpr2\fR" |
3154 | | -\fIexpr1 expr2\fR と同じ。 |
3155 | | - |
3156 | | -.\"O .IP "\fIexpr1\fR \-and \fIexpr2\fR" |
3157 | | -.\"O Same as \fIexpr1 expr2\fR, but not POSIX compliant. |
3158 | | -.\"O |
3159 | | -.IP "\fIexpr1\fR \-and \fIexpr2\fR" |
3160 | | -\fIexpr1 expr2\fR と同じだが、POSIX 準拠の表現ではない。 |
3161 | | - |
3162 | | -.\"O .IP "\fIexpr1\fR \-o \fIexpr2\fR" |
3163 | | -.\"O Or; \fIexpr2\fR is not evaluated if \fIexpr1\fR is true. |
3164 | | -.\"O |
3165 | | -.IP "\fIexpr1\fR \-o \fIexpr2\fR" |
3166 | | -or 結合である。\fIexpr1\fR が真ならば、\fIexpr2\fR は評価されない。 |
3167 | | - |
3168 | | -.\"O .IP "\fIexpr1\fR \-or \fIexpr2\fR" |
3169 | | -.\"O Same as \fIexpr1\fR |
3170 | | -.\"O .B \-o |
3171 | | -.\"O \fIexpr2\fR, but not POSIX compliant. |
3172 | | -.\"O |
3173 | | -.IP "\fIexpr1\fR \-or \fIexpr2\fR" |
3174 | | -\fIexpr1\fR |
3175 | | -.B \-o |
3176 | | -\fIexpr2\fR |
3177 | | -と同じだが、POSIX 準拠の表現ではない。 |
3178 | | - |
3179 | | -.\"O .IP "\fIexpr1\fR , \fIexpr2\fR" |
3180 | | -.\"O List; both \fIexpr1\fR and \fIexpr2\fR are always evaluated. The |
3181 | | -.\"O value of \fIexpr1\fR is discarded; the value of the list is the value |
3182 | | -.\"O of \fIexpr2\fR. The comma operator can be useful for searching for |
3183 | | -.\"O several different types of thing, but traversing the filesystem |
3184 | | -.\"O hierarchy only once. The |
3185 | | -.\"O .B \-fprintf |
3186 | | -.\"O action can be used to list the various matched items into several |
3187 | | -.\"O different output files. |
3188 | | -.\"O |
3189 | | -.\"O |
3190 | | -.IP "\fIexpr1\fR , \fIexpr2\fR" |
3191 | | -リストである。常に \fIexpr1\fR と \fIexpr2\fR の両方が評価される。 |
3192 | | -\fIexpr1\fR の値は捨てられ、\fIexpr2\fR の値がリスト全体の値になる。 |
3193 | | -コンマ演算子はいくつかの異なったタイプの対象を捜すとき便利だが、 |
3194 | | -ファイルシステム階層の探索は一度しか行われない。 |
3195 | | -異なった形でマッチした対象の一覧をそれぞれ別のファイルに書き出すには、 |
3196 | | -.B \-fprintf |
3197 | | -を利用すればよい。 |
3198 | | - |
3199 | | -.IP "[訳注]:" 8 |
3200 | | -.B find |
3201 | | -にとって演算子も引き数である。だから `(', `)', `!', `,' といった演算子も、 |
3202 | | -前後の引き数との間に空白が必要だということに気をつけてほしい。 |
3203 | | - |
3204 | | -.\"O .SH "STANDARDS CONFORMANCE" |
3205 | | -.\"O For closest compliance to the POSIX standard, you should set the |
3206 | | -.\"O POSIXLY_CORRECT environment variable. The following options are |
3207 | | -.\"O specified in the POSIX standard (IEEE Std 1003.1, 2003 Edition): |
3208 | | -.\"O |
3209 | | -.SH "標準への準拠" |
3210 | | -POSIX 標準にできるだけ準拠した動作を求めるのなら、環境変数 |
3211 | | -POSIXLY_CORRECT を設定するとよい。以下のオプションや述語は |
3212 | | -POSIX standard (IEEE Std 1003.1, 2003 Edition) で規定されている。 |
3213 | | - |
3214 | | -.\"O .IP \fB\-H\fR |
3215 | | -.\"O This option is supported. |
3216 | | -.\"O |
3217 | | -.IP \fB\-H\fR |
| 1203 | +.SH 規格への準拠 |
| 1204 | +POSIX 規格にできるだけ準拠した動作を求めるのなら、環境変数 POSIXLY_CORRECT |
| 1205 | +を設定するとよい。以下のオプションや述語は POSIX 規格 |
| 1206 | +(IEEE Std 1003.1, 2003 Edition) で規定されている。 |
| 1207 | + |
| 1208 | +.IP \fB\-H\fP |
| 1209 | +このオプションはサポートしている。 |
| 1210 | + |
| 1211 | +.IP \fB\-L\fP |
3218 | 1212 | このオプションはサポートしている。 |
3219 | 1213 | |
3220 | | -.\"O .IP \fB\-L\fR |
3221 | | -.\"O This option is supported. |
3222 | | -.\"O |
3223 | | -.IP \fB\-L\fR |
3224 | | -このオプションもサポートしている。 |
3225 | | - |
3226 | | -.\"O .IP \fB\-name\fR |
3227 | | -.\"O This option is supported, but POSIX conformance depends on the |
3228 | | -.\"O POSIX conformance of the system's |
3229 | | -.\"O .BR fnmatch (3) |
3230 | | -.\"O library function. As of findutils-4.2.2, shell metacharacters |
3231 | | -.\"O (`*', `?' or `[]' for example) will match a leading `.', because |
3232 | | -.\"O IEEE PASC interpretation 126 requires this. This is a change from |
3233 | | -.\"O previous versions of findutils. |
3234 | | -.\"O |
3235 | | -.IP \fB\-name\fR |
| 1214 | +.IP \fB\-name\fP |
3236 | 1215 | この述語はサポートしている。しかし、POSIX への準拠度は、システムの |
3237 | | -.BR fnmatch (3) |
3238 | | -ライブラリ関数がどの程度 POSIX に準拠しているかに依存している。 |
3239 | | -findutils-4.2.2 以来、シェルのメタ文字 (`*', `?', `[]' など) は、 |
3240 | | -ファイル名の先頭の `.' 文字にマッチするが、 |
3241 | | -これは IEEE PASC interpretation 126 がそう要求しているからである。 |
3242 | | -この動作は それ以前のバージョンの findutils と異なっている。 |
3243 | | - |
3244 | | -.\"O .IP \fB\-type\fR |
3245 | | -.\"O Supported. POSIX specifies `b', `c', `d', `l', `p', `f' and `s'. |
3246 | | -.\"O GNU find also supports `D', representing a Door, where the OS provides these. |
3247 | | -.\"O |
3248 | | -.IP \fB\-type\fR |
3249 | | -サポートしている。POSIX では `b', `c', `d', `l', `p', `f', `s' を |
3250 | | -規定している。GNU find は、そのほか「ドア」を表す `D' もサポートしているが、 |
| 1216 | +\fBfnmatch\fP(3) ライブラリ関数がどの程度 POSIX に準拠しているかに依存している。 |
| 1217 | +findutils\-4.2.2 以来、シェルのメタ文字 (`*', `?', `[]' など) は、 |
| 1218 | +ファイル名の先頭の `.' 文字にマッチするが、これは IEEE PASC interpretation 126 |
| 1219 | +がそう要求しているからである。この動作は それ以前のバージョンの findutils と異なっている。 |
| 1220 | + |
| 1221 | +.IP \fB\-type\fP |
| 1222 | +サポートしている。POSIX では `b', `c', `d', `l', `p', `f', `s' |
| 1223 | +を規定している。GNU find は、そのほか「ドア」を表す `D' もサポートしているが、 |
3251 | 1224 | 使えるのは OS がそうしたファイル・タイプを用意している場合のみである。 |
3252 | 1225 | |
3253 | | -.\"O .IP \fB\-ok\fR |
3254 | | -.\"O Supported. |
3255 | | -.\"O Interpretation of the response is according to the "yes" and "no" |
3256 | | -.\"O patterns selected by setting the `LC_MESSAGES' environment variable. |
3257 | | -.\"O When the `POSIXLY_CORRECT' environment variable is set, these patterns |
3258 | | -.\"O are taken system's definition of a positive (yes) or negative (no) |
3259 | | -.\"O response. See the system's |
3260 | | -.\"O documentation for \fBnl_langinfo\fP(3), in particular YESEXPR and |
3261 | | -.\"O NOEXPR. When `POSIXLY_CORRECT' is not set, the patterns are instead |
3262 | | -.\"O taken from |
3263 | | -.\"O .BR find 's |
3264 | | -.\"O own message catalogue. |
3265 | | -.\"O |
3266 | | -.IP \fB\-ok\fR |
3267 | | -サポートしている。プロンプトに対する応答は、"yes"、"no" を表すパターンに |
3268 | | -照らして解釈されるが、そのパターンは環境変数 `LC_MESSAGES' の設定によって |
3269 | | -選択されたものである。 環境変数 `POSIXLY_CORRECT' が設定されている場合は、 |
3270 | | -何が肯定的応答 (yes) で、何が否定的応答 (no) かを決めているシステムの |
3271 | | -定義が、このパターンに使用される。\fBnl_langinfo\fP(3) に関する |
3272 | | -システムの文書、特に YESEXPR と NOEXPR の部分を参照してほしい。 |
3273 | | -`POSIXLY_CORRECT' が設定されていない場合は、パターンは、システムではなく、 |
3274 | | -.B find |
3275 | | -自身のメッセージ・カタログから取得される。 |
3276 | | - |
3277 | | -.\"O .IP \fB\-newer\fR |
3278 | | -.\"O Supported. If the file specified is a symbolic link, it is always |
3279 | | -.\"O dereferenced. This is a change from previous behaviour, which used to |
3280 | | -.\"O take the relevant time from the symbolic link; see the HISTORY section |
3281 | | -.\"O below. |
3282 | | -.\"O |
3283 | | -.IP \fB\-newer\fR |
3284 | | -サポートしている。指定されたファイルがシンボリックリンクの場合は、 |
3285 | | -必ずリンク先が参照される (訳注: 訳者としては、\fB\-P\fR、\fB\-L\fR、 |
3286 | | -\fB\-H\fR オプションの説明から言って、「\fB\-L\fR や \fB\-H\fR オプションが |
3287 | | -有効な場合は」という条件が必要ではないかと思う)。以前のバージョンでは、 |
3288 | | -シンボリックリンクそのものから比較に使う日時を取得していたのだが、 |
| 1226 | +.IP \fB\-ok\fP |
| 1227 | +サポートしている。プロンプトに対する応答は、"yes"、"no" |
| 1228 | +を表すパターンに照らして解釈されるが、そのパターンは、環境変数 |
| 1229 | +`LC_MESSAGES' を設定することによって選択される。環境変数 |
| 1230 | +`POSIXLY_CORRECT' が設定されている場合は、何が肯定的応答 (yes) |
| 1231 | +で、何が否定的応答 (no) かを決めているシステムの定義が、このパターンとして使用される。 |
| 1232 | +\fBnl_langinfo\fP(3) に関するシステムの文書、特に YESEXPR と NOEXPR |
| 1233 | +の部分を参照してほしい。それに対し、`POSIXLY_CORRECT' が設定されていない場合は、 |
| 1234 | +パターンは、システムではなく、\fBfind\fP の持つメッセージ・カタログから取得されるのである。 |
| 1235 | + |
| 1236 | +.IP \fB\-newer\fP |
| 1237 | +サポートしている。指定されたファイルがシンボリックリンクの場合は、必ずリンク先が参照される |
| 1238 | +(訳注: 訳者としては、「\fB\-L\fP や \fB\-H\fP オプションが有効な場合は」という条件が必要ではないかと思う。 |
| 1239 | +\fB\-P\fP, \fB\-L\fP, \fB\-H\fP オプションや、検査 \fB\-newer\fP の説明を参照)。 |
| 1240 | +以前のバージョンでは、シンボリックリンクそのものから比較に使う日時を取得していたが、 |
3289 | 1241 | 動作がこのように変更になった。後述の「履歴」セクションも参照してほしい。 |
3290 | 1242 | |
3291 | | -.\"O .IP \fB\-perm\fR |
3292 | | -.\"O Supported. If the POSIXLY_CORRECT environment variable is not set, |
3293 | | -.\"O some mode arguments (for example +a+x ) which are not valid in POSIX |
3294 | | -.\"O are supported for backward-compatibility. |
3295 | | -.\"O |
3296 | | -.IP \fB\-perm\fR |
3297 | | -サポートしている。環境変数 POSIXLY_CORRECT が設定されていない場合は、 |
3298 | | -POSIX では無効な +a+x といったモード指定の引き数も、 |
3299 | | -後方互換のために使用できるようになっている。 |
3300 | | - |
3301 | | -.\"O .IP "Other predicates" |
3302 | | -.\"O The predicates |
3303 | | -.\"O .BR \-atime , |
3304 | | -.\"O .BR \-ctime , |
3305 | | -.\"O .BR \-depth , |
3306 | | -.\"O .BR \-group , |
3307 | | -.\"O .BR \-links , |
3308 | | -.\"O .BR \-mtime , |
3309 | | -.\"O .BR \-nogroup , |
3310 | | -.\"O .BR \-nouser , |
3311 | | -.\"O .BR \-print , |
3312 | | -.\"O .BR \-prune , |
3313 | | -.\"O .BR \-size , |
3314 | | -.\"O .BR \-user |
3315 | | -.\"O and |
3316 | | -.\"O .B \-xdev |
3317 | | -.\"O are all supported. |
3318 | | -.\"O |
3319 | | -.IP "その他の述語" |
3320 | | -.BR \-atime , |
3321 | | -.BR \-ctime , |
3322 | | -.BR \-depth , |
3323 | | -.BR \-group , |
3324 | | -.BR \-links , |
3325 | | -.BR \-mtime , |
3326 | | -.BR \-nogroup , |
3327 | | -.BR \-nouser , |
3328 | | -.BR \-print , |
3329 | | -.BR \-prune , |
3330 | | -.BR \-size , |
3331 | | -.BR \-user |
3332 | | -.B \-xdev |
3333 | | -といった述語は、すべてサポートしている。 |
3334 | | - |
3335 | | -.\"O .P |
3336 | | -.\"O The POSIX standard specifies parentheses `(', `)', negation `!' and the |
3337 | | -.\"O `and' and `or' operators ( |
3338 | | -.\"O .BR \-a , |
3339 | | -.\"O .BR \-o ). |
| 1243 | +.IP \fB\-perm\fP |
| 1244 | +サポートしている。環境変数 POSIXLY_CORRECT が設定されていない場合は、POSIX |
| 1245 | +では無効な (たとえば、+a+x といった) モード指定の引き数も、後方互換のために使用できるようになっている |
| 1246 | +(訳注: \fBfind\fP 4.6.0 では、POSIXLY_CORRECT が設定されていないときでも、+a+x のような |
| 1247 | +\fB\-perm\fP +\fImode\fP の形式は使えなくなっている)。 |
| 1248 | + |
| 1249 | +.IP その他の述語 |
| 1250 | +\fB\-atime\fP, \fB\-ctime\fP, \fB\-depth\fP, \fB\-group\fP, \fB\-links\fP, \fB\-mtime\fP, |
| 1251 | +\fB\-nogroup\fP, \fB\-nouser\fP, \fB\-perm\fP, \fB\-print\fP, \fB\-prune\fP, \fB\-size\fP, |
| 1252 | +\fB\-user\fP \fB\-xdev\fP といった述語は、すべてサポートしている。 |
| 1253 | + |
3340 | 1254 | .P |
3341 | | -POSIX 標準は、カッコ `(', `)'、否定 `!'、それに and と or 演算子 |
3342 | | -.RB ( \-a , |
3343 | | -.BR \-o ) |
3344 | | -を規定している。 |
3345 | | -.\"O .P |
3346 | | -.\"O All other options, predicates, expressions and so forth are extensions |
3347 | | -.\"O beyond the POSIX standard. Many of these extensions are not unique to |
3348 | | -.\"O GNU find, however. |
| 1255 | +POSIX 規格は、カッコ `(', `)'、否定 `!'、それに and と or 演算子 |
| 1256 | +(\fB\-a\fP, \fB\-o\fP) を規定している。 |
3349 | 1257 | .P |
3350 | | -上記以外のすべてのオプション、述語、式などは、POSIX 標準にない拡張である。 |
| 1258 | +上記以外のすべてのオプション、述語、式などは、POSIX 規格にない拡張である。 |
3351 | 1259 | とは言え、そうした拡張の多くは、GNU find に特有なものではない。 |
3352 | | -.\"O .P |
3353 | | -.\"O The POSIX standard requires that |
3354 | | -.\"O .B find |
3355 | | -.\"O detects loops: |
3356 | 1260 | .P |
3357 | | -POSIX 標準によれば、 |
3358 | | -.B find |
3359 | | -はループを検出することになっている。 |
3360 | | -.\"O .IP |
3361 | | -.\"O The |
3362 | | -.\"O .B find |
3363 | | -.\"O utility shall detect infinite loops; that is, entering a |
3364 | | -.\"O previously visited directory that is an ancestor of the last file |
3365 | | -.\"O encountered. When it detects an infinite loop, find shall write a |
3366 | | -.\"O diagnostic message to standard error and shall either recover its |
3367 | | -.\"O position in the hierarchy or terminate. |
| 1261 | +POSIX 規格によれば、 \fBfind\fP はループを検出することになっている。 |
3368 | 1262 | .IP |
3369 | | -.B find |
3370 | | -ユーティリティは無限ループを検出しなければならない。無限ループとは、 |
3371 | | -探索中に入ったディレクトリが、すでに探索済みで、最後に処理の対象にした |
3372 | | -ファイルの上位ディレクトリに当たることである。無限ループを検出した場合、 |
3373 | | -find は何が起きたかを告げる診断メッセージを標準エラーに表示し、 |
3374 | | -探索位置をディレクトリ階層上の元の位置に戻すか、終了すべきである。 |
3375 | | -.\"O .P |
3376 | | -.\"O GNU |
3377 | | -.\"O .B find |
3378 | | -.\"O complies with these requirements. The link count of |
3379 | | -.\"O directories which contain entries which are hard links to an ancestor |
3380 | | -.\"O will often be lower than they otherwise should be. This can mean that |
3381 | | -.\"O GNU find will sometimes optimise away the visiting of a subdirectory |
3382 | | -.\"O which is actually a link to an ancestor. Since |
3383 | | -.\"O .B find |
3384 | | -.\"O does not actually enter such a subdirectory, it is allowed to avoid |
3385 | | -.\"O emitting a diagnostic message. Although this behaviour may be |
3386 | | -.\"O somewhat confusing, it is unlikely that anybody actually depends on |
3387 | | -.\"O this behaviour. If the leaf optimisation has been turned off with |
3388 | | -.\"O .BR \-noleaf , |
3389 | | -.\"O the directory entry will always be examined and the diagnostic message |
3390 | | -.\"O will be issued where it is appropriate. Symbolic links cannot be used |
3391 | | -.\"O to create filesystem cycles as such, but if the |
3392 | | -.\"O .B \-L |
3393 | | -.\"O option or the |
3394 | | -.\"O .B \-follow |
3395 | | -.\"O option is in use, a diagnostic message is issued when |
3396 | | -.\"O .B find |
3397 | | -.\"O encounters a loop of symbolic links. As with loops containing hard |
3398 | | -.\"O links, the leaf optimisation will often mean that |
3399 | | -.\"O .B find |
3400 | | -.\"O knows that it doesn't need to call |
3401 | | -.\"O .I stat() |
3402 | | -.\"O or |
3403 | | -.\"O .I chdir() |
3404 | | -.\"O on the symbolic link, so this diagnostic is frequently not necessary. |
| 1263 | +\fBfind\fP ユーティリティは無限ループを検出しなければならない。 |
| 1264 | +無限ループとは、探索中に入ったディレクトリが、すでに訪れたことがあり、しかも直前に処理対象にしたファイルの上位にあるディレクトリであることである。 |
| 1265 | +無限ループを検出した場合、find |
| 1266 | +は何が起きたかを告げる診断メッセージを標準エラーに表示し、探索位置をディレクトリ階層上の元の位置に戻すか、終了すべきである。 |
3405 | 1267 | .P |
3406 | | -GNU |
3407 | | -.B find |
3408 | | -はこうした要求に従っている。ディレクトリがその中に |
3409 | | -上位ディレクトリへのハードリンクであるエントリを含んでいる場合は、 |
3410 | | -ディレクトリのリンク数が、本来ならそうなるはずの数よりも |
3411 | | -たいてい少なくなるものだ。その結果、 |
3412 | | -GNU find が時として、実際には上位ディレクトリへのハードリンクである |
3413 | | -サブディレクトリを、最適化の副作用で探索しないですますことが起こりえる。 |
3414 | | -その場合、 |
3415 | | -.B find |
3416 | | -は確かにそうしたディレクトリに足を踏み入れないわけだから、 |
3417 | | -「ループ検出」の診断メッセージを出さないでもよいことになっている。 |
3418 | | -これはかなり紛らわしい動作かもしれないが、 |
3419 | | -.B find |
3420 | | -のこの動作を本気で当てにしている人もいないことだろう。 |
3421 | | -.B \-noleaf |
3422 | | -オプションを指定して、ディレクトリ・ツリー上の葉っぱを簡易判別する |
3423 | | -最適化を無効にしている場合は (訳注: \fB\-noleaf\fR 参照) 、 |
3424 | | -こうしたディレクトリ・エントリに対する検査も省略されずに行われ、 |
3425 | | -必要ならば、診断メッセージが表示されることになる。 |
3426 | | -シンボリックリンクを使うと、そういったファイルシステム上の循環は |
3427 | | -起きないが、 |
3428 | | -.B \-L |
3429 | | -や |
3430 | | -.B \-follow |
3431 | | -を使用している場合は、探索中に |
3432 | | -シンボリックリンクのループに出会えば、診断メッセージが表示される。 |
3433 | | -ハードリンクを含むループの場合と同様、葉っぱを簡易判別する最適化を |
3434 | | -使用していると、たいていの場合、シンボリックリンクに対して |
3435 | | -.I stat() |
3436 | | -や |
3437 | | -.I chdir() |
3438 | | -を呼び出すまでもないと、 |
3439 | | -.B find |
3440 | | -が承知していることになるので、 |
3441 | | -ループの診断は不要になることが多い。 |
3442 | | -.IP "[訳注]:" 8 |
3443 | | -Linux や BSD 系 Unix のようにディレクトリへのハードリンクを |
3444 | | -作成できない Unix もある。その場合は、上記のハードリンクに関する |
3445 | | -解説は当てはまらない。 |
3446 | | -.\"O .P |
3447 | | -.\"O The |
3448 | | -.\"O .B \-d |
3449 | | -.\"O option is supported for compatibility with various BSD systems, |
3450 | | -.\"O but you should use the POSIX-compliant option |
3451 | | -.\"O .B \-depth |
3452 | | -.\"O instead. |
| 1268 | +GNU \fBfind\fP はそうした要求に従っている。 |
| 1269 | +ディレクトリがその中に上位ディレクトリへのハードリンクであるエントリを含んでいる場合は、 |
| 1270 | +ディレクトリのハードリンク数が、そのエントリが普通のサブディレクトリならそうなるはずの数よりも、たいてい少なくなるものだ |
| 1271 | +(訳注: 実際には、Linux を始め、ディレクトリのハードリンクを禁止しているシステムが多い)。その結果、 |
| 1272 | +GNU find が時として、実際には上位ディレクトリへのハードリンクであるサブディレクトリを、最適化の副作用で探索しないことが起こりえる。その場合、 |
| 1273 | +\fBfind\fP は確かにそうしたディレクトリに足を踏み入れないわけだから、「ループ検出」の診断メッセージを出さないでもよいことになっている。 |
| 1274 | +これはかなり紛らわしい動作かもしれないが、\fBfind\fP のこの動作を本気で当てにしている人もいないことだろう。 |
| 1275 | +\fB\-noleaf\fP オプションを指定して、ディレクトリ・ツリー上の葉っぱを簡易判別する最適化を無効にしている場合は |
| 1276 | +(訳注: \fB\-noleaf\fP 参照)、こうしたディレクトリ・エントリに対する検査も省略されずに行われ、 |
| 1277 | +必要ならば、診断メッセージが表示されることになる。シンボリックリンクを使っていれば、 |
| 1278 | +ファイルシステム上に本物の循環を起こすことはないが、それでも、\fB\-L\fP や \fB\-follow\fP |
| 1279 | +を使用している場合は、探索中にシンボリックリンクのループに出会えば、診断メッセージが表示される。 |
| 1280 | +ハードリンクを含むループの場合と同様、葉っぱを簡易判別する最適化を使用していると、 |
| 1281 | +\fBfind\fP はたいていの場合、シンボリックリンクに対して \fIstat()\fP や \fIchdir()\fP |
| 1282 | +を呼び出すまでもないと知っていることになるので、ループの診断は不要になることが多い。 |
3453 | 1283 | .P |
3454 | | -.B \-d |
3455 | | -オプションは BSD システム各種との互換性のためにサポートされている。 |
3456 | | -だが、POSIX に準拠している |
3457 | | -.B \-depth |
3458 | | -オプションの方を使った方がよい。 |
3459 | | -.\"O .P |
3460 | | -.\"O The POSIXLY_CORRECT environment variable does not affect the behaviour |
3461 | | -.\"O of the |
3462 | | -.\"O .B \-regex |
3463 | | -.\"O or |
3464 | | -.\"O .B \-iregex |
3465 | | -.\"O tests because those tests aren't specified in the POSIX standard. |
| 1284 | +\fB\-d\fP オプションは BSD システム各種との互換性のためにサポートされている。 |
| 1285 | +だが、POSIX に準拠している \fB\-depth\fP オプションの方を使った方がよい。 |
3466 | 1286 | .P |
3467 | | -環境変数 POSIXLY_CORRECT は、判別式 |
3468 | | -.B \-regex |
3469 | | -や |
3470 | | -.B \-iregex |
3471 | | -の動作に影響を与えない。そうした判別式は、POSIX 標準で規定されていない |
3472 | | -からである。 |
3473 | | -.\"O .SH "ENVIRONMENT VARIABLES" |
3474 | | -.\"O |
3475 | | -.SH "環境変数" |
3476 | | - |
3477 | | -.\"O .IP LANG |
3478 | | -.\"O Provides a default value for the internationalization variables that |
3479 | | -.\"O are unset or null. |
3480 | | -.\"O |
| 1287 | +環境変数 POSIXLY_CORRECT は、検査 \fB\-regex\fP や \fB\-iregex\fP の動作に影響を与えない。 |
| 1288 | +そうした検査は、POSIX 規格で規定されていないからである。 |
| 1289 | +.SH 環境変数 |
| 1290 | + |
3481 | 1291 | .IP LANG |
3482 | | -国際化関係の環境変数のうち、値が設定されていなかったり、null だったりする |
3483 | | -変数に対して、LANG の値がデフォルトの値になる。 |
| 1292 | +国際化関係の環境変数のうち、値が設定されていなかったり、null |
| 1293 | +だったりする変数に対して、LANG の値がデフォルトの値になる。 |
3484 | 1294 | |
3485 | | -.\"O .IP LC_ALL |
3486 | | -.\"O If set to a non-empty string value, override the values of all the |
3487 | | -.\"O other internationalization variables. |
3488 | | -.\"O |
3489 | 1295 | .IP LC_ALL |
3490 | | -これが空文字列以外の値に設定されていると、その値が国際化関係の |
3491 | | -他のすべての環境変数の値よりも優先される。 |
3492 | | - |
3493 | | -.\"O .IP LC_COLLATE |
3494 | | -.\"O The POSIX standard specifies that this variable affects the pattern |
3495 | | -.\"O matching to be used for the |
3496 | | -.\"O .B \-name |
3497 | | -.\"O option. GNU find uses the |
3498 | | -.\"O .BR fnmatch (3) |
3499 | | -.\"O library function, and so support for `LC_COLLATE' depends on the |
3500 | | -.\"O system library. This variable also affects the interpretation of |
3501 | | -.\"O the response to |
3502 | | -.\"O .BR \-ok; |
3503 | | -.\"O while the `LC_MESSAGES' variable selects the actual pattern used to |
3504 | | -.\"O interpret the response to |
3505 | | -.\"O .BR \-ok , |
3506 | | -.\"O the interpretation of any bracket expressions in the pattern will be |
3507 | | -.\"O affected by `LC_COLLATE'. |
3508 | | -.\"O |
| 1296 | +この環境変数が空文字列以外の値に設定されていると、その値が国際化関係の他のすべての環境変数の値よりも優先される。 |
| 1297 | + |
3509 | 1298 | .IP LC_COLLATE |
3510 | | -POSIX の規定によれば、この環境変数は判別式 |
3511 | | -.B \-name |
3512 | | -で使われるパターンマッチングに影響する。 |
3513 | | -GNU find は |
3514 | | -.BR fnmatch (3) |
3515 | | -ライブラリ関数を使用しているので、LC_COLLATE への対応は |
3516 | | -システムのライブラリ次第である。また、この変数はアクション |
3517 | | -.B \-ok |
3518 | | -に対する応答の解釈にも影響を及ぼす。 |
3519 | | -.B \-ok |
3520 | | -に対する応答の解釈に使用される実際のパターンは LC_MESSAGES 変数によって |
3521 | | -選択されるのだが、パターン中に角カッコ式が現れた場合の解釈は、LC_COLLATE の |
3522 | | -影響を受けるのである。 |
3523 | | - |
3524 | | -.\"O .IP LC_CTYPE |
3525 | | -.\"O This variable affects the treatment of character classes used in |
3526 | | -.\"O regular expressions and also with |
3527 | | -.\"O the |
3528 | | -.\"O .B \-name |
3529 | | -.\"O test, if the system's |
3530 | | -.\"O .BR fnmatch (3) |
3531 | | -.\"O library function supports this. This variable also affects the |
3532 | | -.\"O interpretation of any character classes in the regular expressions |
3533 | | -.\"O used to interpret the response to the prompt issued by |
3534 | | -.\"O .BR \-ok . |
3535 | | -.\"O The `LC_CTYPE' environment variable will |
3536 | | -.\"O also affect which characters are considered to be unprintable when |
3537 | | -.\"O filenames are printed; see the section UNUSUAL FILENAMES. |
3538 | | -.\"O |
| 1299 | +POSIX の規定によれば、この環境変数は検査 \fB\-name\fP で使われるパターンマッチングに影響する。 |
| 1300 | +GNU find は \fBfnmatch\fP(3) ライブラリ関数を使用しているので、LC_COLLATE |
| 1301 | +への対応はシステムのライブラリ次第である。また、この変数はアクション \fB\-ok\fP |
| 1302 | +に対する応答の解釈にも影響を及ぼす。 \fB\-ok\fP に対する応答の解釈に使用される実際のパターンは |
| 1303 | +LC_MESSAGES 変数によって選択されるのだが、そのパターン中に角カッコ式が使われている場合の解釈は、LC_COLLATE |
| 1304 | +の影響を受けるのである。 |
| 1305 | + |
3539 | 1306 | .IP LC_CTYPE |
3540 | | -この環境変数は、正規表現で使用される文字クラスの扱いに影響する。 |
3541 | | -システムの |
3542 | | -.BR fnmatch (3) |
3543 | | -ライブラリ関数がこの変数に対応している場合は、判別式 |
3544 | | -.B \-name |
3545 | | -の使用にともなう文字クラスの扱いにも影響を及ぼす。また、この変数は、 |
3546 | | -アクション |
3547 | | -.B \-ok |
3548 | | -が出すプロンプトに対してユーザが応答する際、諾否の判断に使用される |
3549 | | -正規表現の文字クラスの解釈にも関係する。さらにまた、環境変数 LC_CTYPE は、 |
3550 | | -ファイル名が表示されるとき、どの文字を表示不可能 (unprintable) と見なすかにも |
3551 | | -かかわることになる。「変わり者のファイル名」セクションを参照してほしい。 |
3552 | | - |
3553 | | -.\"O .IP LC_MESSAGES |
3554 | | -.\"O Determines the locale to be used for internationalised messages. If |
3555 | | -.\"O the `POSIXLY_CORRECT' environment variable is set, this also |
3556 | | -.\"O determines the interpretation of the response to the prompt made by the |
3557 | | -.\"O .BR \-ok |
3558 | | -.\"O action. |
3559 | | -.\"O |
| 1307 | +この環境変数は、正規表現で使用される文字クラスの処理に影響する。 |
| 1308 | +システムの \fBfnmatch\fP(3) ライブラリ関数が対応している場合は、検査 \fB\-name\fP |
| 1309 | +で使われる文字クラスの処理にも影響を及ぼす。また、この変数は、アクション \fB\-ok\fP |
| 1310 | +が出すプロンプトに対してユーザが応答する際、諾否の判断に使用される正規表現に文字クラスが使われていれば、 |
| 1311 | +その解釈にも影響する。さらにまた、環境変数 LC_CTYPEは、ファイル名が表示されるとき、どの文字を表示不可能 (unprintable) |
| 1312 | +と見なすかにもかかわることになる。「変わり者のファイル名」セクションを参照していただきたい。 |
| 1313 | + |
3560 | 1314 | .IP LC_MESSAGES |
3561 | | -国際化されたメッセージのために使用されるロケールを決める。 |
3562 | | -また、環境変数 POSIXLY_CORRECT が設定されている場合は、アクション |
3563 | | -.B \-ok |
3564 | | -が出したプロンプトに対する応答を、どう解釈するかもこの変数が決定する。 |
3565 | | - |
3566 | | -.\"O .IP NLSPATH |
3567 | | -.\"O Determines the location of the internationalisation message catalogues. |
3568 | | -.\"O |
| 1315 | +国際化されたメッセージで使用するロケールを決める。環境変数 `POSIXLY_CORRECT' |
| 1316 | +が設定されている場合でも、やはりこの変数によって、アクション \fB\-ok\fP |
| 1317 | +が出したプロンプトに対する応答をどう解釈するかが決まってくる。 |
| 1318 | + |
3569 | 1319 | .IP NLSPATH |
3570 | 1320 | 国際化メッセージ・カタログを置く場所を決める。 |
3571 | 1321 | |
3572 | | -.\"O .IP PATH |
3573 | | -.\"O Affects the directories which are searched to find the executables |
3574 | | -.\"O invoked by |
3575 | | -.\"O .BR \-exec , |
3576 | | -.\"O .BR \-execdir , |
3577 | | -.\"O .B \-ok |
3578 | | -.\"O and |
3579 | | -.\"O .BR \-okdir . |
3580 | | -.\"O |
3581 | 1322 | .IP PATH |
3582 | | -.BR \-exec , |
3583 | | -.BR \-execdir , |
3584 | | -.BR \-ok , |
3585 | | -.B \-okdir |
| 1323 | +\fB\-exec\fP, \fB\-execdir\fP, \fB\-ok\fP, \fB\-okdir\fP |
3586 | 1324 | によって呼び出される実行ファイルを捜すために検索するディレクトリに影響する。 |
3587 | 1325 | |
3588 | | -.\"O .IP POSIXLY_CORRECT |
3589 | | -.\"O Determines the block size used by |
3590 | | -.\"O .B \-ls |
3591 | | -.\"O and |
3592 | | -.\"O .BR \-fls . |
3593 | | -.\"O If |
3594 | | -.\"O .B POSIXLY_CORRECT |
3595 | | -.\"O is set, blocks are units of 512 bytes. Otherwise |
3596 | | -.\"O they are units of 1024 bytes. |
3597 | 1326 | .IP POSIXLY_CORRECT |
3598 | | -.B \-ls |
3599 | | -や |
3600 | | -.B \-fls |
3601 | | -が使用するブロックサイズを決める。 |
3602 | | -.B POSIXLY_CORRECT |
3603 | | -が設定されているときは、1 ブロック 512 バイト、 |
3604 | | -設定されていないときは、1 ブロック 1024 バイトである。 |
3605 | | -.\"O .IP |
3606 | | -.\"O Setting this variable also turns off |
3607 | | -.\"O warning messages (that is, implies |
3608 | | -.\"O .BR \-nowarn ) |
3609 | | -.\"O by default, because POSIX requires that apart from |
3610 | | -.\"O the output for |
3611 | | -.\"O .BR \-ok , |
3612 | | -.\"O all messages printed on stderr are diagnostics and must result in a |
3613 | | -.\"O non-zero exit status. |
| 1327 | +\fB\-ls\fP や \fB\-fls\fP が使用するブロックサイズを決める。\fBPOSIXLY_CORRECT\fP |
| 1328 | +が設定されているときは、1 ブロック 512 バイト、設定されていないときは、1 ブロック |
| 1329 | +1024 バイトである。 |
3614 | 1330 | .IP |
3615 | 1331 | また、この変数を設定すると、警告メッセージを出さないのがデフォルトになる |
3616 | | -(すなわち、 |
3617 | | -.B \-nowarn |
3618 | | -になるわけだ)。なぜならば、POSIX の規定では、 |
3619 | | -.B \-ok |
3620 | | -の出すプロンプトを除いて、標準エラーに出力されるメッセージはすべて |
3621 | | -問題が起きたことを知らせるものであり、そのときの終了ステータスは |
3622 | | -0 以外でなければならないからである。 |
3623 | | -.\"O .IP |
3624 | | -.\"O When POSIXLY_CORRECT is not set, |
3625 | | -.\"O .B \-perm |
3626 | | -.\"O +zzz |
3627 | | -.\"O is treated just like |
3628 | | -.\"O .B \-perm |
3629 | | -.\"O /zzz |
3630 | | -.\"O if |
3631 | | -.\"O +zzz is not a valid symbolic mode. When POSIXLY_CORRECT is set, such |
3632 | | -.\"O constructs are treated as an error. |
| 1332 | +(すなわち、 \fB\-nowarn\fP になるわけだ)。なぜならば、POSIX の規定では、\fB\-ok\fP |
| 1333 | +の出すプロンプトを除いて、標準エラーに出力されるメッセージは、すべて問題が起きたことを知らせるものであり、 |
| 1334 | +そのときの終了ステータスは 0 以外でなければならないからである。 |
3633 | 1335 | .IP |
3634 | | -POSIXLY_CORRECT が設定されていない場合、 |
3635 | | -+zzz が許可属性を表すシンボルとしてそれ自体有効な表現であるときを除き、 |
3636 | | -.B \-perm |
3637 | | -+zzz は |
3638 | | -.B \-perm |
3639 | | -/zzz とまったく同じように扱われる。 |
3640 | | -POSIXLY_CORRECT が設定されている場合は、許可属性の前に '+' や '/' を取る |
3641 | | -こうした形式は、エラーとして処理される (訳注: もちろん、+zzz がそれ自体 |
3642 | | -有効なシンボル表現であるときを除く。判別式 |
3643 | | -.B \-perm +\fImode\fR |
3644 | | -の説明を参照)。 |
3645 | | -.\"O .IP |
3646 | | -.\"O When POSIXLY_CORRECT is set, the response to the prompt made by the |
3647 | | -.\"O .B \-ok |
3648 | | -.\"O action is interpreted according to the system's message catalogue, as |
3649 | | -.\"O opposed to according to |
3650 | | -.\"O .BR find 's |
3651 | | -.\"O own message translations. |
3652 | | -.\"O |
| 1336 | +POSIXLY_CORRECT が設定されていない場合は、+zzz |
| 1337 | +が許可属性を表すシンボルとしてそれ自体有効な表現であるときを除き、\fB\-perm\fP +zzz |
| 1338 | +は \fB\-perm\fP /zzz とまったく同じように扱われる (訳注: 現在では、 |
| 1339 | +POSIXLY_CORRECT が設定されていない場合も、\fB\-perm\fP +\fImode\fP |
| 1340 | +の書式はサポートされていない。検査 \fB\-perm\fP の説明を参照)。POSIXLY_CORRECT |
| 1341 | +が設定されている場合は、許可属性の前に '+' を取る形式は、エラーとして処理される |
| 1342 | +(訳注: もちろん、+zzz がそれ自体有効なシンボル表現であるときは除く。たとえば、\fB\-perm +u+x\fP |
| 1343 | +といったものがそういう表現である。これは、\fB\-perm 0111\fP |
| 1344 | +という「ぴったり一致する」表現と等価になる)。 |
3653 | 1345 | .IP |
3654 | | -POSIXLY_CORRECT が設定されていると、アクション |
3655 | | -.B \-ok |
3656 | | -が出すプロンプトに対するユーザの応答を解釈する際に、 |
3657 | | -.B find |
3658 | | -の持つメッセージ・カタログではなく、システムのメッセージ・カタログが |
3659 | | -参照される。 |
3660 | | -.\"O .IP TZ |
3661 | | -.\"O Affects the time zone used for some of the time-related format |
3662 | | -.\"O directives of |
3663 | | -.\"O .B \-printf |
3664 | | -.\"O and |
3665 | | -.\"O .BR \-fprintf . |
| 1346 | +POSIXLY_CORRECT が設定されていると、アクション \fB\-ok\fP |
| 1347 | +が出すプロンプトに対するユーザの応答を解釈する際に、\fBfind\fP |
| 1348 | +の持つメッセージ翻訳ではなく、システムのメッセージ・カタログが参照される。 |
| 1349 | + |
3666 | 1350 | .IP TZ |
3667 | | -タイムゾーンに影響する。タイムゾーンは、 |
3668 | | -.B \-printf |
3669 | | -や |
3670 | | -.B \-fprintf |
3671 | | -の日時に関係する一部の書式指定子で使用される。 |
3672 | | -.\"O .SH "EXAMPLES" |
3673 | | -.SH "用例" |
3674 | | -.\"O .nf |
3675 | | -.\"O .B find /tmp \-name core \-type f \-print | xargs /bin/rm \-f |
3676 | | -.\"O |
| 1351 | +タイムゾーンに影響する。タイムゾーンは、\fB\-printf\fP や \fB\-fprintf\fP の日時に関係する一部の書式指定子で使用される。 |
| 1352 | +.SH 用例 |
3677 | 1353 | .nf |
3678 | | -.B find /tmp \-name core \-type f \-print | xargs /bin/rm \-f |
3679 | | - |
3680 | | -.\"O .fi |
3681 | | -.\"O Find files named |
3682 | | -.\"O .B core |
3683 | | -.\"O in or below the directory |
3684 | | -.\"O .B /tmp |
3685 | | -.\"O and delete them. Note that this will work incorrectly if there are |
3686 | | -.\"O any filenames containing newlines, single or double quotes, or spaces. |
| 1354 | +\fBfind /tmp \-name core \-type f \-print | xargs /bin/rm \-f\fP |
| 1355 | + |
3687 | 1356 | .fi |
3688 | | -.B /tmp |
3689 | | -ディレクトリ以下に |
3690 | | -.B core |
3691 | | -という名前のファイルを捜して、それを消去する。名前の中に改行、 |
3692 | | -シングルクォート、ダブルクォート、スペースなどを含むファイルがあるときは、 |
3693 | | -正しく動作しないことに注意すること。 |
3694 | | -.\"O .P |
3695 | | -.\"O .B find /tmp \-name core \-type f \-print0 | xargs \-0 /bin/rm \-f |
3696 | | -.\"O |
| 1357 | +\fB/tmp\fP ディレクトリ以下に \fBcore\fP という名前のファイルを捜して、それを消去する。 |
| 1358 | +ファイル名 (パスを含む) の中に改行、シングルクォート、ダブルクォート、 |
| 1359 | +空白などを含むものがあると、正しく動作しないので、注意すること。 |
3697 | 1360 | .P |
3698 | | -.B find /tmp \-name core \-type f \-print0 | xargs \-0 /bin/rm \-f |
3699 | | - |
3700 | | -.\"O .fi |
3701 | | -.\"O Find files named |
3702 | | -.\"O .B core |
3703 | | -.\"O in or below the directory |
3704 | | -.\"O .B /tmp |
3705 | | -.\"O and delete them, processing filenames in such a way that file or |
3706 | | -.\"O directory names containing single or double quotes, spaces or newlines |
3707 | | -.\"O are correctly handled. The |
3708 | | -.\"O .B \-name |
3709 | | -.\"O test comes before the |
3710 | | -.\"O .B \-type |
3711 | | -.\"O test in order to avoid having to call |
3712 | | -.\"O .B stat(2) |
3713 | | -.\"O on every file. |
3714 | | -.\"O |
| 1361 | +\fBfind /tmp \-name core \-type f \-print0 | xargs \-0 /bin/rm \-f\fP |
| 1362 | + |
3715 | 1363 | .fi |
3716 | | -.B /tmp |
3717 | | -ディレクトリ以下に |
3718 | | -.B core |
3719 | | -という名前のファイルを捜して、それを消去する。ファイル名の処理に当たっては、 |
3720 | | -ファイルやディレクトリの名前にシングルクォート、ダブルクォート、空白、 |
3721 | | -改行などが含まれていても、適切に扱われるようにする。判別式 |
3722 | | -.B \-name |
3723 | | -を |
3724 | | -.B \-type |
3725 | | -の前に置いているのは、すべてのファイルに対して |
3726 | | -.B stat(2) |
3727 | | -システムコールを行う無駄を省くためである。 |
3728 | | - |
3729 | | -.\"O .P |
3730 | | -.\"O .nf |
3731 | | -.\"O .B find . \-type f \-exec file \(aq{}\(aq \e\; |
3732 | | -.\"O |
| 1364 | +\fB/tmp\fP ディレクトリ以下に \fBcore\fP という名前のファイルを捜して、それを消去する。 |
| 1365 | +ファイル名の処理に当たっては、ファイルやディレクトリの名前にシングルクォート、ダブルクォート、空白、改行などが含まれていても、適切に扱われるようにしている。 |
| 1366 | +検査 \fB\-name\fP を \fB\-type\fP の前に置いているのは、すべてのファイルに対して |
| 1367 | +\fBstat(2)\fP システムコールを行う無駄を省くためである。 |
| 1368 | + |
3733 | 1369 | .P |
3734 | 1370 | .nf |
3735 | | -.B find . \-type f \-exec file \(aq{}\(aq \e\; |
3736 | | - |
3737 | | -.\"O .fi |
3738 | | -.\"O Runs `file' on every file in or below the current directory. Notice |
3739 | | -.\"O that the braces are enclosed in single quote marks to protect them |
3740 | | -.\"O from interpretation as shell script punctuation. The semicolon is |
3741 | | -.\"O similarly protected by the use of a backslash, though single quotes |
3742 | | -.\"O could have been used in that case also. |
3743 | | -.\"O |
| 1371 | +\fBfind . \-type f \-exec file \(aq{}\(aq \e;\fP |
| 1372 | + |
3744 | 1373 | .fi |
3745 | | -カレントディレクトリ以下のあらゆるファイルに対して file コマンドを |
3746 | | -実行する。中カッコをシングルクォートで囲んでいることに注目してほしい。 |
| 1374 | +カレントディレクトリ以下のあらゆるファイルに対して file コマンドを実行する。 |
| 1375 | +中カッコをシングルクォートで囲んでいることに注目していただきたい。 |
3747 | 1376 | シェルスクリプトのブロック区切り記号として解釈されないようにするためである。 |
3748 | | -同様に、セミコロンもバックスラッシュを使って保護している。こちらにも |
3749 | | -シングルクォートを使用してもよい。 |
3750 | | - |
3751 | | -.\"O .P |
3752 | | -.\"O .nf |
3753 | | -.\"O .B find / \e |
3754 | | -.\"O .B \e( \-perm \-4000 \-fprintf /root/suid.txt "%#m %u %p\en" \e) , \e |
3755 | | -.\"O .B \e( \-size +100M \-fprintf /root/big.txt "%\-10s %p\en" \e) |
3756 | | -.\"O |
| 1377 | +同様に、セミコロンもバックスラッシュを使って保護している。 |
| 1378 | +こちらにもシングルクォートを使用してもよい。 |
| 1379 | + |
3757 | 1380 | .P |
3758 | 1381 | .nf |
3759 | | -.B find / \e |
3760 | | -.B \e( \-perm \-4000 \-fprintf /root/suid.txt \(dq%#m %u %p\en\(dq \e) , \e |
3761 | | -.B \e( \-size +100M \-fprintf /root/big.txt \(dq%\-10s %p\en\(dq \e) |
3762 | | - |
3763 | | -.\"O .fi |
3764 | | -.\"O Traverse the filesystem just once, listing setuid files and |
3765 | | -.\"O directories into |
3766 | | -.\"O .B /root/suid.txt |
3767 | | -.\"O and large files into |
3768 | | -.\"O .BR /root/big.txt . |
3769 | | -.\"O |
| 1382 | +\fBfind / \e( \-perm \-4000 \-fprintf /root/suid.txt \(aq%#m %u %p\en\(aq \e) , \e\fP |
| 1383 | +\fB\e( \-size +100M \-fprintf /root/big.txt \(aq%\-10s %p\en\(aq \e)\fP |
| 1384 | + |
3770 | 1385 | .fi |
3771 | | -全ファイルシステムを一回だけ探索して、setuid ビットの立っている |
3772 | | -ファイルやディレクトリのリストを |
3773 | | -.B /root/suid.txt |
3774 | | -に、サイズの大きいファイルのリストを |
3775 | | -.B /root/big.txt |
3776 | | -に出力する。 |
3777 | | - |
3778 | | -.\"O .P |
3779 | | -.\"O .nf |
3780 | | -.\"O .B find $HOME \-mtime 0 |
3781 | | -.\"O |
| 1386 | +全ファイルシステムを一回だけ探索して、setuid ビットの立っているファイルやディレクトリのリストを |
| 1387 | +\fB/root/suid.txt\fP に、サイズの大きいファイルのリストを \fB/root/big.txt\fP に出力する。 |
| 1388 | + |
3782 | 1389 | .P |
3783 | 1390 | .nf |
3784 | | -.B find $HOME \-mtime 0 |
3785 | | - |
3786 | | -.\"O .fi |
3787 | | -.\"O Search for files in your home directory which have been modified in |
3788 | | -.\"O the last twenty-four hours. This command works this way because the |
3789 | | -.\"O time since each file was last modified is divided by 24 hours and any |
3790 | | -.\"O remainder is discarded. That means that to match |
3791 | | -.\"O .B \-mtime |
3792 | | -.\"O .BR 0 , |
3793 | | -.\"O a file will have to have a modification in the past which is less than |
3794 | | -.\"O 24 hours ago. |
3795 | | -.\"O |
| 1391 | +\fBfind $HOME \-mtime 0\fP |
| 1392 | + |
3796 | 1393 | .fi |
3797 | | -ここ 24 時間の内に内容が更新されたファイルをホームディレクトリ以下で |
3798 | | -検索する。このコマンドがそういう動作になるのは、それぞれのファイルが |
3799 | | -最後に更新されてから現在までの経過時間が、24 で割り算され、余りは |
3800 | | -切り捨てられるからである。そこで、ファイルが |
3801 | | -.B \-mtime 0 |
3802 | | -にマッチするためには、過去 24 時間未満の期間内に内容が更新されて |
3803 | | -いなければならないことになる。 |
3804 | | - |
3805 | | -.\"O .P |
3806 | | -.\"O .nf |
3807 | | -.\"O .B find /sbin /usr/sbin -executable \e! -readable \-print |
3808 | | -.\"O |
| 1394 | +ここ 24 時間の内に内容が更新されたファイルをホームディレクトリ以下で検索する。 |
| 1395 | +このコマンドがそういう動作になるのは、それぞれのファイルが最後に更新されてから現在までの経過時間が、24 時間で割られて、余りは捨てられるからである。 |
| 1396 | +そこで、ファイルが \fB\-mtime 0\fP にマッチするためには、過去 24 時間未満の期間内に内容が更新されていなければならないことになる。 |
| 1397 | + |
3809 | 1398 | .P |
3810 | 1399 | .nf |
3811 | | -.B find /sbin /usr/sbin -executable \e! -readable \-print |
| 1400 | +\fBfind /sbin /usr/sbin \-executable \e! \-readable \-print\fP |
3812 | 1401 | |
3813 | | -.\"O .fi |
3814 | | -.\"O Search for files which are executable but not readable. |
3815 | | -.\"O |
3816 | 1402 | .fi |
3817 | 1403 | 実行可能でありながら、読み出し不可能なファイルを捜す。 |
3818 | 1404 | |
3819 | | -.\"O .P |
3820 | | -.\"O .nf |
3821 | | -.\"O .B find . \-perm 664 |
3822 | | -.\"O |
3823 | 1405 | .P |
3824 | 1406 | .nf |
3825 | | -.B find . \-perm 664 |
3826 | | - |
3827 | | -.\"O .fi |
3828 | | -.\"O Search for files which have read and write permission for their owner, |
3829 | | -.\"O and group, but which other users can read but not write to. Files |
3830 | | -.\"O which meet these criteria but have other permissions bits set (for |
3831 | | -.\"O example if someone can execute the file) will not be matched. |
3832 | | -.\"O |
| 1407 | +\fBfind . \-perm 664\fP |
| 1408 | + |
3833 | 1409 | .fi |
3834 | | -ファイルの所有者とグループは読むことも書くことも可能だが、 |
3835 | | -他のユーザは読み出しのみ可能で書き込みはできないファイルを捜す。 |
| 1410 | +ファイルの所有者とグループは読むことも書くことも可能だが、他のユーザは読み出しのみ可能で書き込みはできないファイルを捜す。 |
3836 | 1411 | そうした条件を満たすものの、他の許可属性ビットも立っているような |
3837 | | -(たとえば、そのファイルを実行できる人がいるような) ファイルは、 |
3838 | | -この式にマッチしない。 |
| 1412 | +(たとえば、そのファイルを実行できる人がいるような) ファイルは、この式にマッチしない。 |
3839 | 1413 | |
3840 | | -.\"O .P |
3841 | | -.\"O .nf |
3842 | | -.\"O .B find . \-perm \-664 |
3843 | | -.\"O |
3844 | 1414 | .P |
3845 | 1415 | .nf |
3846 | | -.B find . \-perm \-664 |
3847 | | - |
3848 | | -.\"O .fi |
3849 | | -.\"O Search for files which have read and write permission for their owner |
3850 | | -.\"O and group, and which other users can read, without regard to the |
3851 | | -.\"O presence of any extra permission bits (for example the executable |
3852 | | -.\"O bit). This will match a file which has mode 0777, for example. |
3853 | | -.\"O |
| 1416 | +\fBfind . \-perm \-664\fP |
| 1417 | + |
3854 | 1418 | .fi |
3855 | | -ファイルの所有者とグループは読むことも書くことも可能であり、 |
3856 | | -他のユーザも読むことは可能であるようなファイルを捜す。 |
3857 | | -それ以外の許可属性ビットについては (たとえば、実行許可ビット)、 |
3858 | | -立っていてもいなくてもかまわない。この条件は、たとえば、 |
3859 | | -0777 のモードを持つファイルにもマッチすることになる。 |
3860 | | - |
3861 | | -.\"O .P |
3862 | | -.\"O .nf |
3863 | | -.\"O .B find . \-perm /222 |
3864 | | -.\"O |
| 1419 | +ファイルの所有者とグループは読むことも書くことも可能であり、他のユーザも読むことが可能であるようなファイルを捜す。 |
| 1420 | +それ以外の許可属性ビットについては (たとえば、実行許可ビット)、立っていてもいなくてもかまわない。この条件は、たとえば、 0777 |
| 1421 | +のモードを持つファイルにもマッチすることになる。 |
| 1422 | + |
3865 | 1423 | .P |
3866 | 1424 | .nf |
3867 | | -.B find . \-perm /222 |
| 1425 | +\fBfind . \-perm /222\fP |
3868 | 1426 | |
3869 | | -.\"O .fi |
3870 | | -.\"O Search for files which are writable by somebody (their owner, or |
3871 | | -.\"O their group, or anybody else). |
3872 | | -.\"O |
3873 | 1427 | .fi |
3874 | | -誰かが書き込めるようなファイルを捜す (書き込めるのは、ファイルの所有者でも、 |
3875 | | -グループでも、他の一般ユーザでもよい)。 |
3876 | | - |
3877 | | -.\"O .P |
3878 | | -.\"O .nf |
3879 | | -.\"O .B find . \-perm /220 |
3880 | | -.\"O .B find . \-perm /u+w,g+w |
3881 | | -.\"O .B find . \-perm /u=w,g=w |
3882 | | -.\"O |
| 1428 | +書き込める人のいるファイルを捜す (書き込めるのは、ファイルの所有者でも、グループでも、他の一般ユーザでもよい)。 |
| 1429 | + |
3883 | 1430 | .P |
3884 | 1431 | .nf |
3885 | | -.B find . \-perm /220 |
3886 | | -.B find . \-perm /u+w,g+w |
3887 | | -.B find . \-perm /u=w,g=w |
3888 | | - |
3889 | | -.\"O .fi |
3890 | | -.\"O All three of these commands do the same thing, but the first one uses |
3891 | | -.\"O the octal representation of the file mode, and the other two use the |
3892 | | -.\"O symbolic form. These commands all search for files which are |
3893 | | -.\"O writable by either their owner or their group. The files don't have |
3894 | | -.\"O to be writable by both the owner and group to be matched; either will |
3895 | | -.\"O do. |
3896 | | -.\"O |
| 1432 | +\fBfind . \-perm /220\fP |
| 1433 | +\fBfind . \-perm /u+w,g+w\fP |
| 1434 | +\fBfind . \-perm /u=w,g=w\fP |
| 1435 | + |
3897 | 1436 | .fi |
3898 | 1437 | 上記のコマンドは三つとも同じ動作をする。最初のものは、ファイルの許可属性を |
3899 | 1438 | 8 進数で表し、後の二つは、シンボルによる表現形式を使っている。 |
3900 | | -こうしたコマンドはどれも、ファイルの所有者かグループが |
3901 | | -書き込み可能であるようなファイルを捜す。所有者とグループの両方が |
3902 | | -書き込み可能な場合しか、マッチしないわけではない。どちらか片方だけでも |
3903 | | -十分である。 |
3904 | | - |
3905 | | -.\"O .P |
3906 | | -.\"O .nf |
3907 | | -.\"O .B find . \-perm \-220 |
3908 | | -.\"O .B find . \-perm \-g+w,u+w |
3909 | | -.\"O |
| 1439 | +こうしたコマンドはどれも、ファイルの所有者やグループが書き込み可能なファイルを捜す。 |
| 1440 | +所有者とグループの両方が書き込み可能な場合しか、マッチしないわけではない。 |
| 1441 | +どちらか片方だけでも十分である。 |
| 1442 | + |
3910 | 1443 | .P |
3911 | 1444 | .nf |
3912 | | -.B find . \-perm \-220 |
3913 | | -.B find . \-perm \-g+w,u+w |
| 1445 | +\fBfind . \-perm \-220\fP |
| 1446 | +\fBfind . \-perm \-g+w,u+w\fP |
3914 | 1447 | |
3915 | | -.\"O .fi |
3916 | | -.\"O Both these commands do the same thing; search for files which are |
3917 | | -.\"O writable by both their owner and their group. |
3918 | | -.\"O |
3919 | 1448 | .fi |
3920 | | -この二つのコマンドは同じ動作をする。すなわち、ファイルの所有者と |
3921 | | -グループの両方が書き込み可能であるようなファイルを捜す。 |
3922 | | - |
3923 | | -.\"O .P |
3924 | | -.\"O .nf |
3925 | | -.\"O .B find . \-perm \-444 \-perm /222 ! \-perm /111 |
3926 | | -.\"O .B find . \-perm \-a+r \-perm /a+w ! \-perm /a+x |
3927 | | -.\"O |
| 1449 | +この二つのコマンドは同じ動作をする。すなわち、ファイルの所有者とグループの両方が書き込み可能なファイルを捜す。 |
| 1450 | + |
3928 | 1451 | .P |
3929 | 1452 | .nf |
3930 | | -.B find . \-perm \-444 \-perm /222 ! \-perm /111 |
3931 | | -.B find . \-perm \-a+r \-perm /a+w ! \-perm /a+x |
3932 | | - |
3933 | | -.\"O .fi |
3934 | | -.\"O These two commands both search for files that are readable for |
3935 | | -.\"O everybody ( |
3936 | | -.\"O .B \-perm \-444 |
3937 | | -.\"O or |
3938 | | -.\"O .BR "\-perm \-a+r" ), |
3939 | | -.\"O have at least one write bit |
3940 | | -.\"O set ( |
3941 | | -.\"O .B \-perm /222 |
3942 | | -.\"O or |
3943 | | -.\"O .BR "\-perm /a+w" ) |
3944 | | -.\"O but are not executable for anybody ( |
3945 | | -.\"O .B ! \-perm /111 |
3946 | | -.\"O and |
3947 | | -.\"O .B ! \-perm /a+x |
3948 | | -.\"O respectively). |
3949 | | -.\"O |
| 1453 | +\fBfind . \-perm \-444 \-perm /222 \e! \-perm /111\fP |
| 1454 | +\fBfind . \-perm \-a+r \-perm /a+w \e! \-perm /a+x\fP |
| 1455 | + |
3950 | 1456 | .fi |
3951 | 1457 | この二つのコマンドは両方とも次のような条件のファイルを捜す。 |
3952 | | -その条件とは、誰にでも読み出すことが可能で |
3953 | | -.RB ( "\-perm \-444" |
3954 | | -や |
3955 | | -.B "\-perm \-a+r" |
3956 | | -がそれにに当たる)、 |
3957 | | -書き込み許可ビットが少なくとも一つは立っているが |
3958 | | -.RB ( "\-perm /222" |
3959 | | -や |
3960 | | -.BR "\-perm /a+w" )、 |
3961 | | -誰にも実行することはできない |
3962 | | -.RB ( "! \-perm /111" |
3963 | | -や |
3964 | | -.BR "! \-perm /a+x" ) |
3965 | | -というものである。 |
3966 | | - |
3967 | | -.\"O .P |
3968 | | -.\"O .nf |
3969 | | -.\"O .B cd /source-dir |
3970 | | -.\"O .B find . \-name .snapshot \-prune \-o \e( \e! \-name "*~" \-print0 \e)| |
3971 | | -.\"O .B cpio \-pmd0 /dest-dir |
3972 | | -.\"O |
| 1458 | +その条件とは、誰にでも読み出すことが可能で (\fB\-perm \-444\fP や \fB\-perm \-a+r\fP |
| 1459 | +がそれにに当たる)、書き込み許可ビットが少なくとも一つは立っているが |
| 1460 | +(\fB\-perm /222\fP や \fB\-perm /a+w\fP)、誰にも実行することはできない (\fB! \-perm /111\fP |
| 1461 | +や \fB! \-perm /a+x\fP) というものである。 |
| 1462 | + |
3973 | 1463 | .P |
3974 | 1464 | .nf |
3975 | | -.B cd /source-dir |
3976 | | -.B find . \-name .snapshot \-prune \-o \e( \e! \-name "*~" \-print0 \e)| |
3977 | | -.B cpio \-pmd0 /dest-dir |
3978 | | - |
3979 | | -.\"O .fi |
3980 | | -.\"O This command copies the contents of |
3981 | | -.\"O .B /source-dir |
3982 | | -.\"O to |
3983 | | -.\"O .BR /dest-dir , |
3984 | | -.\"O but omits files and directories named |
3985 | | -.\"O .B .snapshot |
3986 | | -.\"O (and anything in them). It also omits files or directories whose name |
3987 | | -.\"O ends in |
3988 | | -.\"O .BR ~ , |
3989 | | -.\"O but not their contents. The construct |
3990 | | -.\"O .B \-prune \-o \e( ... \-print0 \e) |
3991 | | -.\"O is quite common. The idea here is that the expression before |
3992 | | -.\"O .B \-prune |
3993 | | -.\"O matches things which are to be pruned. However, the |
3994 | | -.\"O .B \-prune |
3995 | | -.\"O action itself returns true, so the following |
3996 | | -.\"O .B \-o |
3997 | | -.\"O ensures that the right hand side is evaluated only for those |
3998 | | -.\"O directories which didn't get pruned (the contents of the pruned |
3999 | | -.\"O directories are not even visited, so their contents are irrelevant). |
| 1465 | +\fBcd /source\-dir\fP |
| 1466 | +\fBfind . \-name .snapshot \-prune \-o \e( \e! \-name \(aq*~\(aq \-print0 \e)|\fP |
| 1467 | +\fBcpio \-pmd0 /dest\-dir\fP |
| 1468 | + |
4000 | 1469 | .fi |
4001 | | -このコマンドは |
4002 | | -.B /source-dir |
4003 | | -の中身を |
4004 | | -.B /dest-dir |
4005 | | -にコピーするが、その際 |
4006 | | -.B .snapshot |
4007 | | -という名前のファイルやディレクトリ (及び、そのディレクトリ内のすべて) を |
4008 | | -除外する。さらにこのコマンドは、名前の末尾に |
4009 | | -.B ~ |
4010 | | -が付くファイルやディレクトリも除外するが、そうしたディレクトリの |
4011 | | -中身については除外の対象にしない。 |
4012 | | -.B \-prune \-o \e( ... \-print0 \e) |
4013 | | -という表現はかなりよく利用される。ここで肝腎なのは、 |
4014 | | -.B \-prune |
4015 | | -の前にある式がマッチする項目は、 |
4016 | | -.B find |
4017 | | -の探索の対象から |
4018 | | -.B \-prune |
4019 | | -によって取り除かれる (訳注: pruned、枝刈りされる) ということである。 |
4020 | | -しかし、アクション |
4021 | | -.B \-prune |
4022 | | -自体は返り値として真を返すので、直後に続く |
4023 | | -.B \-o |
4024 | | -によって、 |
4025 | | -探索の対象から取り除かれなかったディレクトリに対してだけ |
4026 | | -.B \-o |
4027 | | -の右辺の評価が行われることになる (探索の対象から取り除かれた |
4028 | | -ディレクトリの中身は処理の対象にすらならないので、そうしたものは |
4029 | | -もう関係がない)。 |
4030 | | -.\"O The expression on the right hand side of the |
4031 | | -.\"O .B \-o |
4032 | | -.\"O is in parentheses only for clarity. It emphasises that the |
4033 | | -.\"O .B \-print0 |
4034 | | -.\"O action takes place only for things that didn't have |
4035 | | -.\"O .B \-prune |
4036 | | -.\"O applied to them. Because the default `and' condition between tests |
4037 | | -.\"O binds more tightly than |
4038 | | -.\"O .BR \-o , |
4039 | | -.\"O this is the default anyway, but the parentheses help to show |
4040 | | -.\"O what is going on. |
4041 | | -.\"O |
4042 | | -.B \-o |
4043 | | -の右辺の式がカッコで囲まれているのは、見やすくするためにすぎない。 |
4044 | | -アクション |
4045 | | -.B \-print0 |
4046 | | -が行われるのは、 |
4047 | | -.B \-prune |
4048 | | -が適用されなかった項目のみであることを強調しているわけだ。 |
4049 | | -述語間のデフォルトの結合は and であり、and 条件の結合は |
4050 | | -.BR \-o |
4051 | | -よりも強いから、カッコがあってもデフォルトの動作と同じなのだが、 |
4052 | | -カッコを使うと、何をやっているかがわかりやすくなる。 |
4053 | | - |
4054 | | -.\"O .P |
4055 | | -.\"O .nf |
4056 | | -.\"O .B find repo/ -exec test -d {}/.svn -o -d {}/.git -o -d {}/CVS \; \e |
4057 | | -.\"O .B -print -prune |
| 1470 | +このコマンドは \fB/source\-dir\fP の中身を \fB/dest\-dir\fP にコピーするが、 |
| 1471 | +その際 \fB.snapshot\fP という名前のファイルやディレクトリ (及び、そのディレクトリ内にあるもの) を除外している。 |
| 1472 | +さらにこのコマンドは、名前の末尾に \fB~\fP が付くファイルやディレクトリも除外するが、 |
| 1473 | +そうしたディレクトリの中身については除外の対象にしない。 |
| 1474 | +\fB\-prune \-o \e( \&...\& \-print0 \e)\fP という構文はかなりよく利用される。 |
| 1475 | +ここで肝腎なのは、\fB\-prune\fP の前にある式がマッチする項目は、\fBfind\fP の探索の対象から |
| 1476 | +\fB\-prune\fP によって取り除かれる (訳注: pruned、枝刈りされる) ということである。 |
| 1477 | +しかし、アクション \fB\-prune\fP 自体は返り値として真を返すので、直後に続く \fB\-o\fP |
| 1478 | +によって、探索の対象から取り除かれなかったディレクトリに対してだけ \fB\-o\fP の右辺の評価が行われることになる |
| 1479 | +(探索の対象から取り除かれたディレクトリの中身は、処理の対象にすらならないのだから、そうしたものはもう関係がない)。 |
| 1480 | +\fB\-o\fP の右辺の式をカッコで囲んでいるのは、見やすくするためにすぎない。 |
| 1481 | +アクション \fB\-print0\fP が行われるのは、 \fB\-prune\fP が適用されなかった項目のみであることを強調しているだけだ。 |
| 1482 | +述語間のデフォルトの結合は and であり、and の結合は \fB\-o\fP よりも強いから、 |
| 1483 | +カッコがあってもデフォルトの動作と同じなのだが、カッコを使うと、何をやっているかがわかりやすくなる。 |
| 1484 | + |
4058 | 1485 | .P |
4059 | 1486 | .nf |
4060 | | -.B find repo/ -exec test -d {}/.svn -o -d {}/.git -o -d {}/CVS \e\; \e |
4061 | | -.B -print -prune |
4062 | | -.\"O .fi |
4063 | | -.\"O |
4064 | | -.\"O Given the following directory of projects and their associated SCM |
4065 | | -.\"O administrative directories, perform an efficient search for the |
4066 | | -.\"O projects' roots: |
4067 | | -.\"O |
| 1487 | +\fBfind repo/ \e( \-exec test \-d {}/.svn \e; \-or \e\fP |
| 1488 | +\fB\-exec test \-d {}/.git \e; \-or \-exec test \-d {}/CVS \e; \e) \e\fP |
| 1489 | +\fB\-print \-prune\fP |
4068 | 1490 | .fi |
4069 | 1491 | |
4070 | | -以下のようなプロジェクトのディレクトリとそれに関連する |
4071 | | -SCM (ソースコード管理システム) の管理用ディレクトリがある場合に、 |
4072 | | -プロジェクトのルートを効率的に検索する。 |
4073 | | - |
4074 | | -.\"O .nf |
4075 | | -.\"O .B repo/project1/CVS |
4076 | | -.\"O .B repo/gnu/project2/.svn |
4077 | | -.\"O .B repo/gnu/project3/.svn |
4078 | | -.\"O .B repo/gnu/project3/src/.svn |
4079 | | -.\"O .B repo/project4/.git |
4080 | | -.\"O |
| 1492 | +以下のようなプロジェクトのディレクトリとそれに関連する SCM (ソースコード管理システム) |
| 1493 | +の管理用ディレクトリがある場合に、プロジェクトのルートを効率的に検索する。 |
| 1494 | + |
4081 | 1495 | .nf |
4082 | | -.B repo/project1/CVS |
4083 | | -.B repo/gnu/project2/.svn |
4084 | | -.B repo/gnu/project3/.svn |
4085 | | -.B repo/gnu/project3/src/.svn |
4086 | | -.B repo/project4/.git |
4087 | | - |
4088 | | -.\"O .fi |
4089 | | -.\"O In this example, |
4090 | | -.\"O .B \-prune |
4091 | | -.\"O prevents unnecessary descent into directories that have already been |
4092 | | -.\"O discovered (for example we do not search project3/src because we |
4093 | | -.\"O already found project3/.svn), but ensures sibling directories |
4094 | | -.\"O (project2 and project3) are found. |
4095 | | -.\"O |
| 1496 | +\fBrepo/project1/CVS\fP |
| 1497 | +\fBrepo/gnu/project2/.svn\fP |
| 1498 | +\fBrepo/gnu/project3/.svn\fP |
| 1499 | +\fBrepo/gnu/project3/src/.svn\fP |
| 1500 | +\fBrepo/project4/.git\fP |
| 1501 | + |
4096 | 1502 | .fi |
4097 | | -この例では、 |
4098 | | -.B \-prune |
4099 | | -を使うことによって、すでにプロジェクトのルートであることがわかった |
4100 | | -ディレクトリ以下で不必要な探索をしないですませている (たとえば、 |
4101 | | -project3/src は探索しないが、それは project3/.svn がすでに見つかって |
4102 | | -いるからである)。それでいて、同格のディレクトリ (たとえば、 |
| 1503 | +この例では、\fB\-prune\fP を使うことによって、すでにプロジェクトのルートであることがわかったディレクトリ以下で不必要な探索をしないですませている |
| 1504 | +(たとえば、project3/src は探索しないが、それは project3/.svn |
| 1505 | +がすでに見つかっているからだ)。それでいて、同格のディレクトリ (たとえば、 |
4103 | 1506 | project2 と project3) はきちんと見つかるようにしている。 |
| 1507 | +(訳注: この例の場合、カッコは必要である。and の結合は or よりも強いので。) |
4104 | 1508 | |
4105 | | -.\"O .SH EXIT STATUS |
4106 | | -.\"O .PP |
4107 | | -.\"O .B find |
4108 | | -.\"O exits with status 0 if all files are processed successfully, greater |
4109 | | -.\"O than 0 if errors occur. This is deliberately a very broad |
4110 | | -.\"O description, but if the return value is non-zero, you should not rely |
4111 | | -.\"O on the correctness of the results of |
4112 | | -.\"O .BR find . |
4113 | | -.\"O |
4114 | | -.SH "終了ステータス" |
| 1509 | +.SH 終了ステータス |
4115 | 1510 | .PP |
4116 | | -.B find |
4117 | | -は、すべてのファイルを問題なく処理できれば、ステータス 0 で終了する。 |
4118 | | -エラーが起きた場合の終了ステータスは、1 以上である。ここではあえて |
4119 | | -ごく大雑把な言い方をしているが、返り値が 0 以外だった場合は、 |
4120 | | -.B find |
| 1511 | +\fBfind\fP は、すべてのファイルを問題なく処理できれば、ステータス 0 で終了する。 |
| 1512 | +エラーが起きた場合の終了ステータスは、1 以上である。 |
| 1513 | +ここではあえてごく大雑把な言い方をしているが、返り値が 0 以外だった場合は、\fBfind\fP |
4121 | 1514 | が出した結果を正しいと思い込まない方がよいだろう。 |
4122 | 1515 | |
4123 | | -.\"O .SH "SEE ALSO" |
4124 | | -.\"O \fBlocate\fP(1), \fBlocatedb\fP(5), \fBupdatedb\fP(1), \fBxargs\fP(1), |
4125 | | -.\"O \fBchmod\fP(1), \fBfnmatch\fP(3), \fBregex\fP(7), \fBstat\fP(2), |
4126 | | -.\"O \fBlstat\fP(2), \fBls\fP(1), \fBprintf\fP(3), \fBstrftime\fP(3), |
4127 | | -.\"O \fBctime\fP(3), \fBFinding Files\fP (on-line in Info, or printed). |
4128 | | -.SH "関連項目" |
4129 | | -\fBlocate\fP(1), \fBlocatedb\fP(5), \fBupdatedb\fP(1), \fBxargs\fP(1), |
4130 | | -\fBchmod\fP(1), \fBfnmatch\fP(3), \fBregex\fP(7), \fBstat\fP(2), |
4131 | | -\fBlstat\fP(2), \fBls\fP(1), \fBprintf\fP(3), \fBstrftime\fP(3), |
4132 | | -\fBctime\fP(3), \fBFinding Files\fP (on-line in Info, or printed). |
4133 | | -.\"O .SH "HISTORY" |
4134 | | -.\"O As of findutils-4.2.2, shell metacharacters (`*', `?' or `[]' for |
4135 | | -.\"O example) used in filename patterns will match a leading `.', because |
4136 | | -.\"O IEEE POSIX interpretation 126 requires this. |
4137 | | -.SH "履歴" |
4138 | | -findutils-4.2.2 以来、ファイル名のパターンに使われたシェルのメタ文字 |
4139 | | -(`*', `?', `[]' など) は、先頭の `.' にマッチする。これは、 |
4140 | | -IEEE POSIX interpretation 126 がそう要求しているからである。 |
4141 | | -.\"O .P |
4142 | | -.\"O The syntax |
4143 | | -.\"O \.B \-perm +MODE |
4144 | | -.\"O was deprecated in findutils-4.2.21, in favour of |
4145 | | -.\"O \.B \-perm |
4146 | | -.\"O .BR /MODE . |
4147 | | -.\"O As of findutils-4.3.3, |
4148 | | -.\"O .B \-perm /000 |
4149 | | -.\"O now matches all files instead of none. |
| 1516 | +エラーが起きた場合、\fBfind\fP は、指定されたすべての動作を完了せず、 |
| 1517 | +その場で終了してしまうことがある。その場合は、たとえば、探索開始点のあるものが調査されなかったり、 |
| 1518 | +\fB\-exec \&...\& {} +\fP や \fB\-execdir \&...\& {} +\fP |
| 1519 | +で呼び出されることになっているプログラムに実行されないものが生じたりするかもしれない。 |
| 1520 | + |
| 1521 | + |
| 1522 | +.SH 関連項目 |
| 1523 | +\fBlocate\fP(1), \fBlocatedb\fP(5), \fBupdatedb\fP(1), \fBxargs\fP(1), \fBchmod\fP(1), |
| 1524 | +\fBfnmatch\fP(3), \fBregex\fP(7), \fBstat\fP(2), \fBlstat\fP(2), \fBls\fP(1), |
| 1525 | +\fBprintf\fP(3), \fBstrftime\fP(3), \fBctime\fP(3) |
| 1526 | + |
| 1527 | +\fBfind\fP には、Texinfo マニュアルの形で保守されている充実した文書がある。 |
| 1528 | +\fBinfo\fP と \fBfind\fP プログラムが、御使用のサイトできちんとインストールされているならば、 |
| 1529 | +\fBinfo find\fP とコマンドを打ち込むことで、詳細なマニュアルが読めるはずだ。 |
| 1530 | +(訳注: \fBinfo find\fP だと、説明が途中からになるので、\fBinfo "Finding files"\fP |
| 1531 | +と打ち込むことをお勧めする。) |
| 1532 | + |
| 1533 | +.SH 履歴 |
| 1534 | +findutils\-4.2.2 以来、ファイル名のパターンに使われるシェルのメタ文字 |
| 1535 | +(`*', `?', `[]' など) は、先頭の `.' にマッチする。 |
| 1536 | +これは、IEEE POSIX interpretation 126 がそう要求しているからである。 |
4150 | 1537 | .P |
4151 | | -.B \-perm +MODE |
4152 | | -という書き方は findutils-4.2.21 で非推奨になった。 |
4153 | | -.B \-perm /MODE |
4154 | | -を使用する方をお勧めする。 |
4155 | | -findutils-4.3.3 以来、 |
4156 | | -.B \-perm /000 |
4157 | | -はどんなファイルにもマッチしないではなく、すべてのファイルにマッチする |
4158 | | -になっている。 |
4159 | | -.\"O .P |
4160 | | -.\"O Nanosecond-resolution |
4161 | | -.\"O timestamps were implemented in findutils-4.3.3. |
| 1538 | +findutils\-4.3.3 以来、\fB\-perm /000\fP |
| 1539 | +は、どんなファイルにもマッチしないではなく、すべてのファイルにマッチする、になっている。 |
4162 | 1540 | .P |
4163 | | -ナノ秒まで表現するタイムスタンプは findutils-4.3.3 で実装された。 |
4164 | | -.\"O .P |
4165 | | -.\"O As of findutils-4.3.11, the |
4166 | | -.\"O .B \-delete |
4167 | | -.\"O action sets |
4168 | | -.\"O .BR find 's |
4169 | | -.\"O exit status to a nonzero value when it fails. |
4170 | | -.\"O However, |
4171 | | -.\"O .B find |
4172 | | -.\"O will not exit immediately. Previously, |
4173 | | -.\"O .BR find 's |
4174 | | -.\"O exit status was unaffected by the failure of |
4175 | | -.\"O .BR \-delete . |
| 1541 | +ナノ秒まで表現するタイムスタンプは findutils\-4.3.3 で実装された。 |
4176 | 1542 | .P |
4177 | | -findutils-4.3.11 以来、アクション |
4178 | | -.B \-delete |
4179 | | -は、実行に失敗すると、 |
4180 | | -.B find |
4181 | | -の終了ステータスを 0 以外の値に設定する。とは言え、 |
4182 | | -.B \-delete |
4183 | | -に失敗したとき、 |
4184 | | -.B find |
4185 | | -が即座に終了してしまうわけではない。以前のバージョンでは、 |
4186 | | -.B \-delete |
4187 | | -が実行に失敗しても、 |
4188 | | -.B find |
4189 | | -の終了ステータスは影響を受けなかった。 |
4190 | | -.\"O .TS |
4191 | | -.\"O l l l . |
4192 | | -.\"O Feature Added in Also occurs in |
4193 | | -.\"O \-newerXY 4.3.3 BSD |
4194 | | -.\"O \-D 4.3.1 |
4195 | | -.\"O \-O 4.3.1 |
4196 | | -.\"O \-readable 4.3.0 |
4197 | | -.\"O \-writable 4.3.0 |
4198 | | -.\"O \-executable 4.3.0 |
4199 | | -.\"O \-regextype 4.2.24 |
4200 | | -.\"O \-exec ... + 4.2.12 POSIX |
4201 | | -.\"O \-execdir 4.2.12 BSD |
4202 | | -.\"O \-okdir 4.2.12 |
4203 | | -.\"O \-samefile 4.2.11 |
4204 | | -.\"O \-H 4.2.5 POSIX |
4205 | | -.\"O \-L 4.2.5 POSIX |
4206 | | -.\"O \-P 4.2.5 BSD |
4207 | | -.\"O \-delete 4.2.3 |
4208 | | -.\"O \-quit 4.2.3 |
4209 | | -.\"O \-d 4.2.3 BSD |
4210 | | -.\"O \-wholename 4.2.0 |
4211 | | -.\"O \-iwholename 4.2.0 |
4212 | | -.\"O \-ignore_readdir_race 4.2.0 |
4213 | | -.\"O \-fls 4.0 |
4214 | | -.\"O \-ilname 3.8 |
4215 | | -.\"O \-iname 3.8 |
4216 | | -.\"O \-ipath 3.8 |
4217 | | -.\"O \-iregex 3.8 |
4218 | | -.\"O .TE |
| 1543 | +findutils\-4.3.11 以来、アクション \fB\-delete\fP は、実行に失敗すると、 |
| 1544 | +\fBfind\fP の終了ステータスを 0 以外の値にする。とは言え、\fBfind\fP |
| 1545 | +がその場で即座に終了してしまうわけではない。以前のバージョンでは、\fB\-delete\fP |
| 1546 | +が実行に失敗しても、\fBfind\fP の終了ステータスは影響を受けなかった。 |
4219 | 1547 | .TS |
4220 | 1548 | l l l . |
4221 | | -Feature Added in Also occurs in |
| 1549 | +Feature Added in Also occurs in |
4222 | 1550 | \-newerXY 4.3.3 BSD |
4223 | 1551 | \-D 4.3.1 |
4224 | 1552 | \-O 4.3.1 |