From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 14 19:05:09 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7986106564A for ; Tue, 14 Feb 2012 19:05:09 +0000 (UTC) (envelope-from matthewstory@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 956CC8FC18 for ; Tue, 14 Feb 2012 19:05:09 +0000 (UTC) Received: by vcmm1 with SMTP id m1so323798vcm.13 for ; Tue, 14 Feb 2012 11:05:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=M/lWAMOd82RatRscDKzBq5IBgKo+vXxovWDUE24Gm6U=; b=HgsayHuykPL/rGD85h9PMluOwkV1Eqo230qBciofOKP2ZscHnvQvrrkrLTOeL7nYtr M6MbK9rwvm79LEYW9XdJTxS7dVoV7pHZYoYlfEaLJr2NiuCjv/T4R9RfcJhQOgwJ/ydy Ir8tpKQmlE9sKW/wOqRRtlYWojbe7tSNCo8NI= MIME-Version: 1.0 Received: by 10.220.142.5 with SMTP id o5mr12587093vcu.68.1329246308912; Tue, 14 Feb 2012 11:05:08 -0800 (PST) Received: by 10.52.21.84 with HTTP; Tue, 14 Feb 2012 11:05:08 -0800 (PST) In-Reply-To: References: Date: Tue, 14 Feb 2012 14:05:08 -0500 Message-ID: From: Matthew Story To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: xargs short-circuit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2012 19:05:09 -0000 On Tue, Feb 14, 2012 at 1:34 PM, Matthew Story 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