Article View: comp.unix.shell
Article #1428Re: How to pipe stderr to a command in Bourne or Korn shell
From: Paul John Falstad
Date: Mon, 08 Oct 1990 21:12
Date: Mon, 08 Oct 1990 21:12
18 lines
1310 bytes
1310 bytes
In article <1990Oct8.204053.15797@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes:
>|> |> How can one redirect stderr to a command while leaving stdout unaffected ?
>A similar approach will work in sh (and probably ksh), although there's
>probably some better way to do it with various hideous file descriptor
>reassignments (I don't use the bourne shell a lot, so I don't qualify to
>invent hideous file descriptor reassignments :-):
>
> (program > /dev/tty) 2>&1 | command
They're not that hideous!
In bash, sh, and (I'm fairly sure) ksh, you can do this and avoid the
subshell:
program 2>&1 >/dev/tty | command
--
Are you nervy? Irritable? Depressed? Tired of life? Keep it up!
Technical Details
Message-ID:
<3207@idunno.Princeton.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!wuarchive!udel!princeton!flower.Princeton.EDU!pfalstadReferences:
<1990Oct8.165133.17187@cti-software.nl> <6133@ge-dab.GE.COM> <1990Oct8.204053.15797@athena.mit.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!wuarchive!udel!princeton!flower.Princeton.EDU!pfalstad From: pfalstad@flower.Princeton.EDU (Paul John Falstad) Newsgroups: comp.unix.shell Subject: Re: How to pipe stderr to a command in Bourne or Korn shell Message-ID: <3207@idunno.Princeton.EDU> Date: 8 Oct 90 21:12:05 GMT References: <1990Oct8.165133.17187@cti-software.nl> <6133@ge-dab.GE.COM> <1990Oct8.204053.15797@athena.mit.edu> Sender: news@idunno.Princeton.EDU Organization: Princeton University, Princeton, New Jersey Lines: 18