Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!orc!inews!iwarp.intel.com!gargoyle!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.shell Subject: Re: How to pipe stderr to a command in Bourne or Korn shell Message-ID: <1990Oct11.153829.12927@chinet.chi.il.us> Date: 11 Oct 90 15:38:29 GMT References: <6133@ge-dab.GE.COM> <1990Oct8.204053.15797@athena.mit.edu> <5069:Oct903:10:1390@kramden.acf.nyu.edu> Organization: Chinet - Public Access UNIX Lines: 25 In article <5069:Oct903:10:1390@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: >But who said there's a tty around? What if Pim wanted to pipe his output >through yet another command? > > ( exec 5>&1; exec 1>&2; exec 2>&5; foo ) | err-processor > >Even you :-) should be able to recognize the swap idiom there. Start >from basic constructs like this and soon you'll be piping stdout and >stderr through separate commands. Someday you may even learn to use >multitee... [grin] Or FIFO's (which might even be available on his machine...) /etc/mknod /tmp/fifo$$ p err-processor < /tmp/fifo$$ & command 2>/tmp/fifo$$ | output_processor rm /tmp/fifo$$ Straightforward enough, and err-processor would not even be required to have a common parent with the rest of the programs if they have some way of determining the name to use. Les Mikesell les@chinet.chi.il.us