On Thu, Aug 15, 2013 at 06:59:26PM +0200, Joey Hess wrote:
> Rene Engelhard wrote:
>> I thought about find not caring about the -exec return status, but:
>> rene@frodo:~$ find tmp -name "notexisting" | xargs rm
> No -exec there.
> It seems find *does* ignore the -exec exit status, which is news to me,
> and seems to make -exec a misfeature.
> joey@gnu:~/tmp/empty>touch file
> joey@gnu:~/tmp/empty>find -exec false {} \; && echo $?
> 0
> The man page is rather unclear about this. I think it's referring to
> the value returned by -exec and usable by other find options, and not by the
> value returned by find.
Hello,
I think you understond this correctly. find's behavior is what posix seems
to require[1], with '{} ;' the respective expression evaluates as false,
but find exits successfully:
----------------------------
(SID)ametzler@pferdchen:/tmp/findtest$ find -type f \( -exec false {} \; -or
-printf 'command failed on %p\n' \) ; echo $?
command failed on ./file1
command failed on ./file2
0
----------------------------
OTOH '-exec command {} +' exits with exitcode 1 when the invoked command
fails.
cu Andreas
[1] http://pubs.opengroup.org/onlinepubs/9699919799/
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]