bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug or changed behaviour in GNU find?


From: Andreas Metzler
Subject: Re: Bug or changed behaviour in GNU find?
Date: Tue, 27 Nov 2012 19:05:08 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On 2012-11-27 Marcel Loose <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]