I think I found a bug in find
(i.e. I don’t think I’m just using it wrong).
If I type:
find . -name *~ -o -name *.o -print
it only find *.o files.
If I type:
find . -name *.o -o -name *~ -print
then it only finds *~ files.
I.E. it is ignoring files found before the OR.
If my syntax is wrong, could someone please correct me.
If my syntax is not wrong, then find has a bug.
I’m running 6.2.1B PE.
Wojtek Lerch <Wojtek_L@yahoo.ca> wrote:
Bill Caroselli wrote:
I think I found a bug in find
(i.e. I don’t think I’m just using it wrong).
If I type:
find . -name *~ -o -name *.o -print
it only find *.o files.
…
I think the problem is that implicit “and” before the -print has a
precedence over the “or”, i.e. your syntax is equivalent to
find . ( -name *~ ) -o ( -name *.o -a -print )
I see that the docs mention the implicit -a operand, but it’s a subtle
point. I’ll add this example to the docs.
Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems
wrong syntax
you need
find . -name *~ -print -o -name *.o -print
Bill Caroselli wrote:
I think I found a bug in find
(i.e. I don’t think I’m just using it wrong).
If I type:
find . -name *~ -o -name *.o -print
it only find *.o files.
If I type:
find . -name *.o -o -name *~ -print
then it only finds *~ files.
I.E. it is ignoring files found before the OR.
If my syntax is wrong, could someone please correct me.
If my syntax is not wrong, then find has a bug.
I’m running 6.2.1B PE.
–
cburgess@qnx.com
Bill Caroselli wrote:
I think I found a bug in find
(i.e. I don’t think I’m just using it wrong).
If I type:
find . -name *~ -o -name *.o -print
it only find *.o files.
…
I think the problem is that implicit “and” before the -print has a
precedence over the “or”, i.e. your syntax is equivalent to
find . ( -name *~ ) -o ( -name *.o -a -print )
Colin Burgess <cburgess@qnx.com> wrote:
CB > wrong syntax
CB > you need
CB > find . -name *~ -print -o -name *.o -print
What I’ve settled on is:
find . ( -name *~ -o -name *.o ) -print
My -print command is actually -remove! but I also use this find
syntax to -exec other commands.