🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1455

Re: How to pipe stderr to a command in Bourne or Korn shell

#1455
From: Paul Chamberlain
Date: Tue, 09 Oct 1990 22:23
23 lines
1564 bytes
In article <3002@wyse.wyse.com> bob@wyse.UUCP (Bob McGowen x4312 dept208) writes:
>In article <1990Oct8.165133.17187@cti-software.nl>, pim@cti-software.nl writes:
>> How can one redirect stderr to a command while leaving stdout unaffected ?
>The question was how to redirect to a command, not a file.  You might think
>that something like 2| would work, but it doesn't (at least in sh, I have
>no ksh to try it on).
>
>I have tried several permutations of re-ordering file descriptors and trying
>to use new ones with the _exec- builtin but have had no success yet.

Just thought I'd take a stab at it.  There may be a better way.
I use Korn Shell.

$ echo now is the time > xx
$ rm -f zz
$ ( cat zz xx 2>&1 1>&3 | od -c ) 3>&1
now is the time
0000000   c   a   t   :       c   a   n   n   o   t       o   p   e   n
0000020       z   z  \n
0000024

Paul Chamberlain | I do NOT represent IBM.     tif@doorstop, sc30661 at ausvm6
512/838-7008     | ...!cs.utexas.edu!ibmaus!auschs!doorstop.austin.ibm.com!tif
Technical Details
Message-ID: <3812@awdprime.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!romp!auschs!awdprime!doorstop.austin.ibm.com!tif
References: <1990Oct8.165133.17187@cti-software.nl> <6133@ge-dab.GE.COM> <3002@wyse.wyse.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!romp!auschs!awdprime!doorstop.austin.ibm.com!tif
From: tif@doorstop.austin.ibm.com (Paul Chamberlain)
Newsgroups: comp.unix.shell
Subject: Re: How to pipe stderr to a command in Bourne or Korn shell
Message-ID: <3812@awdprime.UUCP>
Date: 9 Oct 90 22:23:47 GMT
References: <1990Oct8.165133.17187@cti-software.nl> <6133@ge-dab.GE.COM> <3002@wyse.wyse.com>
Sender: news@awdprime.UUCP
Reply-To: tif@doorstop.austin.ibm.com (Paul Chamberlain)
Organization: IBM AWD, Austin, TX
Lines: 23