Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Redirecting shell output to a pipe
- X-seq: zsh-users 14604
- From: "Nadav Har'El" <nyh@xxxxxxxxxxxxxxxxxxx>
- To: Joke de Buhr <joke.de.buhr@xxxxxxxxx>
- Subject: Re: Redirecting shell output to a pipe
- Date: Wed, 25 Nov 2009 15:44:41 +0200
- Cc: zsh-users@xxxxxxx
- Hebrew-date: 8 Kislev 5770
- In-reply-to: <200911251252.48892.joke.de.buhr@xxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20091124143140.GA7612@xxxxxxxxxxxxxxxxxxxxxxxxxx> <4B0C2709.5080307@xxxxxxx> <20091125064801.GA8371@xxxxxxxxxxxxxxxxxxxxxxxxxx> <200911251252.48892.joke.de.buhr@xxxxxxxxx>
Hi,
On Wed, Nov 25, 2009, Joke de Buhr wrote about "Re: Redirecting shell output to a pipe":
> > > exec |& tee filename
>
> you should replace exec with a command. NOT the "exec" builtin. using the
> builtin exec command doesn't make much sense in this context:
I think there was a misunderstanding here. When I used the word "exec" I
didn't mean it as a replacement for any executable, but rather the specific
keyword "exec". I know all about the syntax for redirection of ordinary
commands (I've been using Unix shells for the past 25 years ;-)).
What I was asking was not about redirecting an invidual command, but rather
redirecting all the shell's output, from now on. The syntax to do that
for redirection to a file is:
exec > filename
Just like that - with the keyword "exec". It's a bizarre syntax, I admit,
but one that has existed for decades (it is not a zsh-specific feature).
My question was how do you do that - i.e., redirection of all the shell's
output - but not to a file but rather a command, e.g., the command
"tee filename". I was hoping that the following would work:
exec | tee filename
would work, but it doesn't, and I was wondering if anybody knew why - is
this an oversight or deliberate. I also gave a working, but way too difficult
alternative to achieve the same thing using a coprocess.
Thanks,
Nadav.
--
Nadav Har'El | Wednesday, Nov 25 2009, 8 Kislev 5770
nyh@xxxxxxxxxxxxxxxxxxx |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |:(){ :|:&};: # DANGER: DO NOT run this,
http://nadav.harel.org.il |unless you REALLY know what you're doing!
Messages sorted by:
Reverse Date,
Date,
Thread,
Author