
私はランニング中に予備選挙という概念に出会いましたman find
。
.
.
.
PRIMARIES
All primaries which take a numeric argument allow the number to be preceded by a plus sign (``+'') or a minus sign (``-''). A preceding plus sign means ``more than n'', a pre-
ceding minus sign means ``less than n'' and neither means ``exactly n''.
.
.
-depth n
True if the depth of the file relative to the starting point of the traversal is n.
検索中POSIXドキュメント「予備選挙」では結果が見つかりませんでした。
少し調べてみると、プライマリはスイッチやフラグ、メイン引数の後に表示されるため、スイッチやフラグとは異なるようです。
$ find -depth 1 .
find: illegal option -- e
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
$ find . -depth 1
./.DS_Store
./.vagrant
./foo
./some
不思議なんだけど:
- 予備選挙とは何ですか?
- それらについて読むことができるドキュメントはありますか?
- スイッチやフラグとどう違うのでしょうか?
答え1
これらは の言語の条件/アクションでありfind
、使用行で参照される「式」は主に 、 、 などで構成されます。 -name
という用語は、これらを、-type
、-print
、および括弧-exec
のみを組み合わせる演算子と区別するために使用されます。!
-a
-o
私はその用語が 以外の文脈で使われているのを見た覚えはありませんfind
。POSIX仕様find
そして、FreeBSD マニュアルページGNU はこの点でも際立っており、GNU find のドキュメント (例えば、manページ)は、この用語は使用せず、代わりに予備選挙をテストファイルのプロパティについて行動何かをする、そしてオプションそれ自体の動作に影響しますfind
。この除算は役に立つように見えますが、すべてのプライマリは、アクションであっても、真理値を返すため、少し不正確です。