Re: Capture stdout and stderr from child process

From: Derk Gwen (derkgwen_at_HotPOP.com)
Date: 08/29/03


Date: Fri, 29 Aug 2003 19:49:20 -0000

shiuyuan@yahoo.com (Peter Tan) wrote:
# Hello,
#
# I am trying to capture standard output and error from unix shell
# running as a child process. I understand that to do so, I need to use
# pseudo terminal. But the problem is the slave side combine stdout and
# stderr nad print them out together on the terminal. My question is if
# there is a way to separate stderr and stdout?

In shell or C programs?

In bourne shell and derivatives, it's just
        command for the child process >redirected-stdout 2>redirected-stderr
You can easily redirect stdout to a pipe, and less easily you can redirect
stderr to another pipe.

--
Derk Gwen http://derkgwen.250free.com/html/index.html
The little stoner's got a point.


Relevant Pages