Piping stderr in Korn and/or Bourne

carroll at m.cs.uiuc.edu carroll at m.cs.uiuc.edu
Sun Apr 8 02:39:20 AEST 1990


/* Written  1:28 pm  Apr  5, 1990 by brad at SSD.CSD.HARRIS.COM in m.cs.uiuc.edu:comp.unix.questions */
/* ---------- "Piping stderr in Korn and/or Bourne" ---------- */
>I bow to any of you knowledgeable souls out there
>that can assist me with this problem ...
>
>I have a program that is supposed to read error output from other
>programs. I want to pipe stderr to this program WITHOUT piping
>stdin as well. I have not been able to find this in TFM (I have 
>been looking at pages 136-140 in Korn's book). 
> [ ... ]
>I was hoping one of these last two might give me the output:
>
>    this is stdout
>    this is STDerr
>
>I  would really like to be able to redirect only stderr to my program
>and to leave stdout untouched! (all in a single command). Can this be
>done in ksh? (sh? csh?)
/* End of text from m.cs.uiuc.edu:comp.unix.questions */
Here are two solutions I came up with:

tst 2>&1 >/dev/tty | sed ...
tst 3>&2 2>&1 >&3 | sed ...

Alan M. Carroll                Barbara/Marilyn in '92 :
carroll at cs.uiuc.edu            + This time, why not choose the better halves?
Epoch Development Team         + A Bush/Quayle ticket you can feel good about
CS Grad / U of Ill @ Urbana    ...{ucbvax,pur-ee,convex}!cs.uiuc.edu!carroll



More information about the Comp.unix.questions mailing list