Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Is this possible with MULTIOS
- X-seq: zsh-users 10894
- From: Meino Christian Cramer <Meino.Cramer@xxxxxx>
- To: schaefer@xxxxxxxxxxxxxxxx
- Subject: Re: Is this possible with MULTIOS
- Date: Mon, 23 Oct 2006 06:41:23 +0200 (CEST)
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <061022193054.ZM16624@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20061022.161634.41652125.Meino.Cramer@xxxxxx> <061022193054.ZM16624@xxxxxxxxxxxxxxxxxxxxxx>
From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
Subject: Re: Is this possible with MULTIOS
Date: Sun, 22 Oct 2006 19:30:54 -0700
> On Oct 22, 4:16pm, Meino Christian Cramer wrote:
> }
> } upcnt=`<update-cmd> | <filter> | wc -l`
> } if [ 0 -ne upcnt ]
>
> If the filter is grep, it exits with a success code when it finds a
> matching line or with failure when it does not, so you should be able
> to do
>
> if update-cmd | grep ...
> then recompile
> else ...
> fi
>
> This would behave differently only if grep matched some lines and then
> exited with an error.
>
> However, to answer your literal question, yes, you can do this with
> multios. You just have to open an extra descriptor outside of the
> subshell and redirect stdout to it inside the subshell.
>
> setopt multios
> uncnt=$(update-cmd | filter 1>&3 | wc -l) 3>&1
>
Hi Bart,
*thanks a lot* :)
Both solutions will help me !
Have a nice week!
mncc
Messages sorted by:
Reverse Date,
Date,
Thread,
Author