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: Eric Blake
Subject: Re: Bug or changed behaviour in GNU find?
Date: Tue, 27 Nov 2012 12:52:42 -0500 (EST)

> $ find . -name "*.h" -o -name "*.cc" -o -name "*.tcc"

This is equivalent to:

find . \( -name "*.h" -o -name "*.cc" -o -name "*.tcc" \) -print

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

This is equivalent to:

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?

You're missing parenthesis, and you are mis-remembering, because find
has never worked the way you seem to be wanting.  Remember that the
implicit -print acts on the entire expression, but that the moment you
use an explicit -print or -print0, then parentheses are necessary to
make the operation have the same scope.



reply via email to

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