findコマンドで優先順位を付けるには、括弧バックスラッシュを使用する必要がありますか?

findコマンドで優先順位を付けるには、括弧バックスラッシュを使用する必要がありますか?

このコマンドでは

find . -xdev -type f \( -mtime 0 -or -mtime 1 \) -exec cp -aPv "{}" $dest.new \;

括弧は\( -mtime 0 -or -mtime 1 \)優先順位を意味しますか?

前にバックスラッシュが来るべきですか?なぜ?

ベストアンサー1

はい、括弧は優先順位を意味し、シェルエスケープにはバックスラッシュが必要です。からman find

   ( expr )
          Force  precedence.   Since  parentheses  are special to the shell, you will normally need to quote them.  Many of the examples in this manual page use backslashes for this purpose: `\(...\)'
          instead of `(...)'.

したがって、あなたの例では、単に-orステートメントをグループ化します。そしてより多くの情報ここ優先順位順です。

おすすめ記事