From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9526 invoked from network); 16 Aug 2004 03:35:55 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 16 Aug 2004 03:35:55 -0000 Received: (qmail 6820 invoked from network); 16 Aug 2004 03:35:50 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 16 Aug 2004 03:35:50 -0000 Received: (qmail 12946 invoked by alias); 16 Aug 2004 03:35:07 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7858 Received: (qmail 12936 invoked from network); 16 Aug 2004 03:35:07 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 16 Aug 2004 03:35:07 -0000 Received: (qmail 4088 invoked from network); 16 Aug 2004 03:33:09 -0000 Received: from sccimhc91.asp.att.net (63.240.76.165) by a.mx.sunsite.dk with SMTP; 16 Aug 2004 03:33:07 -0000 Received: from louisville.edu (12-220-223-80.client.insightbb.com[12.220.223.80]) by sccimhc91.asp.att.net (sccimhc91) with SMTP id <20040816033306i9100bugsoe>; Mon, 16 Aug 2004 03:33:06 +0000 Date: Sun, 15 Aug 2004 23:33:04 -0400 Subject: Re: Slightly OT: Error-Handling in a Pipeline, preferably non-zsh Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v553) From: Aaron Davies To: zsh-users@sunsite.dk Content-Transfer-Encoding: 7bit In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.553) X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: ** X-Spam-Status: No, hits=2.5 required=6.0 tests=BAYES_44,FROM_ENDS_IN_NUMS, RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 2.5 On Sunday, August 15, 2004, at 10:42 PM, Bart Schaefer wrote: > On Sun, 15 Aug 2004, Aaron Davies wrote: > >> How do I do return-value error handling in the middle of a pipeline? > > Or you could skip the awk and xargs entirely and use a while loop: > > ps aux | grep $name | grep -v grep | grep -v $0 | > while read user pid remainder > do > $@ $pid > done What do you think of the solution I replied to Phillipe with, using xargs with "-r" and just checking the pipestatus to determine exit? > As a final note, you probably want "$@" in double quotes. Really? I used it with multi-word commands (like "kill -9") with no problems. -- __ __ / ) / ) /--/ __. .__ ______ / / __. , __o _ _ / (_(_/|_/ (_(_) / (_ (__/_(_/|_\/ <__