Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Feb 2012 14:05:08 -0500
From:      Matthew Story <matthewstory@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: xargs short-circuit
Message-ID:  <CAB%2B9ogc3uM%2Bu5WGgham%2BfrNPGHNu_NvNGba7BqyNHyfqhXbShw@mail.gmail.com>
In-Reply-To: <CAB%2B9ogcT3OxMKwTY%2B8KfzJfcBiHRBnSdSxcy2eYR6bn=uoL1UQ@mail.gmail.com>
References:  <CAB%2B9ogcT3OxMKwTY%2B8KfzJfcBiHRBnSdSxcy2eYR6bn=uoL1UQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 14, 2012 at 1:34 PM, Matthew Story <matthewstory@gmail.com>wrote:

> After reading the man-page, and browsing around the internet for a minute,
> I was just wondering if there is an option in (any) xargs to short-circuit
> on first failure of [utility [arguments]].
>
> e.g.
>
> $ jot - 1 10 | xargs -e -n1 sh -c 'echo "$&"; exit 1' worker || echo $? #
cp error on my part, should not read echo exit 1, just exit 1

> 1
> 1
>
> such that any non-0 exit code in a child process would cause xargs to stop
> processing.  seems like this would be a nice feature to have.
>

apologies for the copy-paste error.

-- 
regards,
matt



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAB%2B9ogc3uM%2Bu5WGgham%2BfrNPGHNu_NvNGba7BqyNHyfqhXbShw>