find: Combining Primaries With Operators
1
1 2.11 Combining Primaries With Operators
1 =======================================
1
1 Operators build a complex expression from tests and actions. The
1 operators are, in order of decreasing precedence:
1
1 '( EXPR )'
1 Force precedence. True if EXPR is true.
1
1 '! EXPR'
1 '-not EXPR'
1 True if EXPR is false. In some shells, it is necessary to protect
1 the '!' from shell interpretation by quoting it.
1
1 'EXPR1 EXPR2'
1 'EXPR1 -a EXPR2'
1 'EXPR1 -and EXPR2'
1 And; EXPR2 is not evaluated if EXPR1 is false.
1
1 'EXPR1 -o EXPR2'
1 'EXPR1 -or EXPR2'
1 Or; EXPR2 is not evaluated if EXPR1 is true.
1
1 'EXPR1 , EXPR2'
1 List; both EXPR1 and EXPR2 are always evaluated. True if EXPR2 is
1 true. The value of EXPR1 is discarded. This operator lets you do
1 multiple independent operations on one traversal, without depending
1 on whether other operations succeeded. The two operations EXPR1
1 and EXPR2 are not always fully independent, since EXPR1 might have
1 side effects like touching or deleting files, or it might use
1 '-prune' which would also affect EXPR2.
1
1 'find' searches the directory tree rooted at each file name by
1 evaluating the expression from left to right, according to the rules of
1 precedence, until the outcome is known (the left hand side is false for
1 '-and', true for '-or'), at which point 'find' moves on to the next file
1 name.
1
1 There are two other tests that can be useful in complex expressions:
1
1 -- Test: -true
1 Always true.
1
1 -- Test: -false
1 Always false.
1