The man page for gnu find states:
Please note that -a when specified implicitly (for example by two tests appearing without an explicit operator between them) or explicitly has higher precedence than -o. This means that
find . -name afile -o -name bfile -print
will never print afile.
I'm guessing the above expression equates to:
find . -name afile -o -name bfile -a -print
My question is, how does this expression work? and why will afile never be printed?
X -o Y -a Zis parsed asX -o ( Y -a Z )rather than(X -o Y) -a Z. The same way as1 + 2 * 3 = 7, rather than9. – Satō Katsura Aug 06 '16 at 11:08andis somewhat akin to multiplication, andorto addition, it's natural forandto have higher precedence. – ilkkachu Aug 06 '16 at 11:24