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 7861
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Slightly OT: Error-Handling in a Pipeline, preferably non-zsh
- Date: Mon, 16 Aug 2004 00:41:31 -0700 (PDT)
- In-reply-to: <FB67F66A-EF34-11D8-83BE-000502631FBD@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <FB67F66A-EF34-11D8-83BE-000502631FBD@xxxxxxxxxxxxxx>
- Reply-to: zsh-users@xxxxxxxxxx
On Sun, 15 Aug 2004, Aaron Davies wrote:
> > ps aux | grep $name | grep -v grep | grep -v $0 |
>
> What do you think of the solution I replied to Phillipe with, using
> xargs with "-r" and just checking the pipestatus to determine exit?
It should work fine. It just isn't what (I thought) you were asking for
-- it still runs both awk and xargs even when the greps find nothing.
> > As a final note, you probably want "$@" in double quotes.
>
> Really? I used it with multi-word commands (like "kill -9") with no
> problems.
What happens when one of the arguments of the command is a quoted word
containing spaces? E.g. supposing your "generalized killall" is named
"runcommandonpidof" (since you've never told us what it _is_ called), try
sleep 30 &
runcommandonpidof sleep print -l "this should be on one line"
(and try it in a non-zsh shell, where word splitting applies; no cheating
by letting zsh preserve the quoting for you, you asked for portability).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author