最近Linuxでシェルを学んでいます。質問があります。
次のコマンドを参照してください。
$ find . -name '*.c' -or -name '*.cpp'
上記のコマンドは、次のコマンドのように内部的に処理されますか?
$ find . -name '*.c' -and -print -or -name '*.cpp' -and -print
ベストアンサー1
man find
説明する:
If the whole expression contains no actions other than -prune or -print,
-print is performed on all files for which the whole expression is true.
はい。同じですが、次のように考えるのは簡単です。
find . \( -name '*.c' -or -name '*.cpp' \) -and -print
またはより簡単で、POSIXに準拠しています。
find . \( -name '*.c' -o -name '*.cpp' \) -print