Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: pipes and redirection
- X-seq: zsh-users 474
- From: Geoff Wing <gwing@xxxxxxxxxxxxxxx>
- To: gsker@xxxxxxxxxxxxxxxxx
- Subject: Re: pipes and redirection
- Date: Wed, 30 Oct 1996 09:08:37 +1100 (EST)
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <Pine.SOL.3.95.961029130246.11799A-100000@xxxxxxxxxxxxxxxxxxx> from "Gerald Skerbitz" at Oct 29, 96 01:22:23 pm
Gerald Skerbitz wrote:
:I've been trying desparately to do something with the shell and failing.
:The goal is to get stdout to go to a file, and stderr to be piped to
:another program.
:If I do this:
:(print -u2 This is stderr;print This is stdout) 2>&1 1>test
:Then the file "test" contains the string "This is stdout"
:and "This is stderr" is printed to the terminal.
:
:So, assuming that the pipe (|) should send the stdout (file descriptor 1) on
:to the program, I tried this:
:(print -u2 This is stderr;print This is stdout) 2>&1 1>test | less
:which brought up less, with _both_ strings displayed.
:So, clearly, the | is picking up both streams.
:Is there a way to cleanly do what I want it to do?
You could always do:
coproc (print -u2 This is stderr;print This is stdout) 2>&p >test ; less <&p
--
Geoff Wing [gwing@xxxxxxxxxxxxxxx] PrimeNet - Internet Consultancy
Web : http://www.primenet.com.au/ Phone : +61-3-9818 2977
Mobile: 0412 162 441 Facsimile: +61-3-9819 3788
Messages sorted by:
Reverse Date,
Date,
Thread,
Author