[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: If the expression contains *any action* anywhere (excluding -prune),
Re: If the expression contains *any action* anywhere (excluding -prune), the user must provide all actions.
Tue, 05 Apr 2011 10:35:13 -0600
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:220.127.116.11) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9
On 04/04/2011 10:47 PM, Peggy Russell wrote:
> The bottom line seemed to be, I wasn't sure when an implicit `print` was going
> to occur. Ah! Now I get it. If the expression contains *any action* anywhere,
> the user must provide all actions.
Correct, for the right definition of actions.
> The exception to that rule is `-prune`. It is
> the absent of any action that creates:
> `\( entire expression \) -a -print`
-prune is not an action. According to POSIX:
only -exec, -ok, and -print are actions (all other POSIX-mandated
primaries are non-actions).
Since -prune is POSIX-mandated, I think we have a documentation bug -
-prune should be listed among the TESTS section of the man page rather
than the ACTIONS section.
Meanwhile, since -delete, -execdir, -fls, -fprint, -fprint0, -fprintf,
-ls, -okdir, -print0, -printf, and -quit are not mandated by POSIX, it
makes sense for GNU findutils to describe those as additional actions
that suppress the implicit -print behavior.
But, once we account for the documentation bug of -prune being listed in
the wrong section, your analysis of several sample commands and when the
implicit \( \) -print is added are correct.
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Description: OpenPGP digital signature