Home directory の dotfiles の一覧がほしいと思って、次の commnad を実行した:
find . -name '.*' -type f -maxdepth 1 -ls
すると、次の error が出た:
find: 警告: オプションでない引数 -name の後に -maxdepth オプションを指定しました。しかし位置オプションではありません (-maxdepth は前に指定しても後に指定してもテストに影響を及ぼします)。オプションは他の引数の前に指定してください。
なんだろうこれは。
英語で error message を見たいので、次の command を実行した:
LANG=C find . -name '.*' -type f -maxdepth 1 -ls
Error message は
find: warning: you have specified the -maxdepth option after a non-option argument -name, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.
となった。
"a non-option argument -name" にびっくりした。 -name って、 option じゃなかったんだ! そう思って man (http://linuxjm.osdn.jp/html/GNU_findutils/man1/find.1.html) を見ると、 -name は「判別式」に分類されていて、「オプション」とは区別されている。なるほどね。
ついでに、 man を見たおかげで、 -print と -ls の違いもわかった。得した。
Error message の "options are not positional" の意味がよくわからない。辞書で "positional" を引いても「位置的」としか出てこない。位置的、とは何だろうか。だが、後に続く
"-maxdepth affects tests specified before it as well as those specified after it"
がその言い換えだと仮定すれば、 "positional" とは「書く位置によって効果が変わる」の意味だろう。