Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Slightly OT: Error-Handling in a Pipeline, preferably non-zsh
- X-seq: zsh-users 7858
 
- From: Aaron Davies <agdavi01@xxxxxxxxxxxxxx>
 
- To: zsh-users@xxxxxxxxxx
 
- Subject: Re: Slightly OT: Error-Handling in a Pipeline, preferably non-zsh
 
- Date: Sun, 15 Aug 2004 23:33:04 -0400
 
- In-reply-to: <Pine.LNX.4.61.0408151913400.935@xxxxxxxxxxxxxxxxxx>
 
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
 
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  _  _
 /  (_(_/|_/ (_(_) / (_  (__/_(_/|_\/ <__</_/_)_
Messages sorted by:
Reverse Date,
Date,
Thread,
Author