On 2012-11-27 Marcel Loose <[email protected]> wrote:
[...]
> $ find . -name "*.h" -o -name "*.cc" -o -name "*.tcc"
> ./foo.h
> ./foo.cc
> ./foo.tcc

> $ find . -name "*.h" -o -name "*.cc" -o -name "*.tcc" -print0 | tr '\0' '\n'
> ./foo.tcc

> IIRC this used to work with older version of find. Has something changed
> in find's behaviour, or am I missing something else here?

Hello,
4.1.20 behaves exactly the same, and afaiui find works as documented,
the command is equivalent to

find . -name "*.h" -o -name "*.cc" -o -name "*.tcc" -and  -print

("Two expressions in a row are taken to be joined with an
implied "and";). And -a has higher precedence than -o. You need to force
precedence with parentheses:
find . \( -name "*.h" -o -name "*.cc" -o -name "*.tcc" \) -print0 | \
  tr '\0' '\n'

cu andreas
-- 
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'

Reply via email to