[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Interaction between -o and the default-print
From: |
Bob Proulx |
Subject: |
Re: Interaction between -o and the default-print |
Date: |
Sun, 31 Oct 2004 10:12:33 -0700 |
User-agent: |
Mutt/1.5.6+20040907i |
James Youngman wrote:
> giuseppe bonacci wrote:
> > according to the man-page and info, the expected output from the
> > following find commands should be identical:
> > [...]
> > myhost# find . -name b -prune -o -type f -print
> > [...]
> > myhost# find . -name b -prune -o -type f # ABNORMAL
> > [...]
>
> I don't think this is a bug, because "find xxx" is equivalent to "find
> \( xxx \) -print" and not to "find xxx -print". (This statement
> applies if none of the actions in xxx include -print anyway).
>
> So, I think the second command in the above example should be
> equvalent to "find . \( -name b -prune -o -type f \) -print", not to
> the first command. Viz :-
> [...]
> I've also sent this to address@hidden in case someone there can
> think of a reason why this is wrong..
Silence is not always the best form of agreement. Let me say as a
crosscheck that I agree with your analysis. This is not a bug in
find. It is behaving as expected and required.
The POSIX docs say:
If no expression is present, -print shall be used as the
expression. Otherwise, if the given expression does not contain
any of the primaries -exec, -ok, or -print, the given expression
shall be effectively replaced by:
( given_expression ) -print
Therefore using the above case these two examples must be identical in
behavior.
find . -name b -prune -o -type f
find . \( -name b -prune -o -type f \) -print
Bob
--
Bob Proulx <address@hidden>
http://www.proulx.com/~bob/
CP-ASEL-IA-Tailwheel-Glider