bug-findutils
[Top][All Lists]
Advanced

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

Re: "find" ends with exit code "0" although exec command returned an err


From: James Youngman
Subject: Re: "find" ends with exit code "0" although exec command returned an error
Date: Fri, 18 Dec 2015 22:55:56 +0000

I've updated the documentation to make this clearer.

On Mon, Oct 5, 2015 at 4:12 PM, Stephane Chazelas
<address@hidden> wrote:
> In the case of:
>
> find  ... -exec cmd {} \;
>
> The exit status of cmd is used to determines whether the
> predicate evaluates to true or false.
>
> For instance:
>
> find . -exec test -d {} \; -print
>
> Would print the paths of the files that are directories or
> symlink to directories, the standard equivalent of the
> GNU-specific:
>
> find . -xtype d -print
>
> If you want find to be aborted with a non-zero exit status as
> soon as any invocation of cmd fails, you could do:
>
> find . \( -exec cmd {} \; -o -exec sh -c 'kill "$PPID"' \; \)
>
> In the case of:
>
> find ... -exec cmd {} +
>
> The predicate always evaluates to true, but the exit status of
> find will be non-zero if any of the invocation of find will
> return with a non-zero exit status.
>
> --
> Stephane
>
>



-- 
--
This email is intended solely for the use of its addressee, sender,
and any readers of a mailing list archive in which it happens to
appear.   If you have received this email in error, please say or type
three times, "I believe in the utility of email disclaimers," and then
reply to the author correcting any spellings (and, optionally, any
incorrect spellings), accompanying these with humorous jests about the
author's parentage.   If you are not the addressee, you are
nevertheless permitted to both copy and forward this email since
without such permissions email systems are unable to transmit email to
anybody, intended recipient or not.  To those still reading by this
point, the author would like to apologise for being unable to maintain
a consistent level of humour throughout this disclaimer.  Contents may
settle during transit.  Do not feed the animals.



reply via email to

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