Xref: utzoo comp.sources.wanted:9575 alt.sources.wanted:46 Path: utzoo!attcan!telly!eci386!jmm From: jmm@eci386.uucp (John Macdonald) Newsgroups: comp.sources.wanted,alt.sources.wanted Subject: Re: separate redirection of stderr and stdout in csh. Message-ID: <1989Nov27.171928.17527@eci386.uucp> Date: 27 Nov 89 17:19:28 GMT References: <13928@teraida.UUCP> <690@fylz.UUCP> Reply-To: jmm@eci386.UUCP (John Macdonald) Organization: R. H. Lathwell Associates: Elegant Communications, Inc. Lines: 30 In article deven@rpi.edu (Deven T. Corzine) writes: > >As many people pointed out, the following works: > > (dumb_command > good_stuff) >& errors > >However, I don't believe it is possible to redirect stderr while >piping stdout to another command... (Yes, you could put the entire >pipeline in a subshell, but you can't have just one command from the >pipeline have its stderr split away...) Well, it actually is possible, but even more than the "double-redirect using a sub-shell" solution, you have to shuffle things around and cheat a little bit. You use a named pipe! If you wanted (in sh-syntax): com1 | com2 2>com2.err | com3 You would write (in csh): mknod pipe$$ p com3 pipe$$) >&com2.err rm pipe$$ This is sufficiently contorted (and I always have to experiment to be sure that I am using a named pipe right) that I would normally instead write (in csh): sh -c 'com1 | com2 2>com2.err | com3' -- 80386 - hardware demonstrating the fractal nature of warts. | John Macdonald EMS/LIM - software demonstrating the fractal nature of warts. | jmm@eci386 Brought to you by Super Global Mega Corp .com