On Thu, 8 Jan 2009, Mark Post wrote:

> >>> On 1/8/2009 at 12:36 PM, John McKown <joa...@swbell.net> wrote:
> > Is there any better way, in a bash script, to pipe both stdout and stderr
> > from an application other than using a subshell? So far the only way that
> > I've thought of to do it is:
> >
> > (command parm1 ... 2>&1) | othercommand
>
> Just:
> command parm1 2>&1 | othercommand
>
> should work.  If it doesn't for you, can you provide a specific example?
>
> Mark Post

Well, shoot. That never even occurred to me. What I thought that would do
was:

Change stderr to go where stdout currently goes, then change stdout to go
into the pipe. I based this on the fact that if I do:

command 2>&1 1>x.tmp

Then stderr still comes to my terminal. It does not go to x.tmp.  I guess
there is some special code in bash to recognize the redirection & piping
as "special".

--
Q: What do theoretical physicists drink beer from?
A: Ein Stein.

Maranatha!
John McKown

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to