Getting the result of a command that is piped to tee

Getting the result of a command that is piped to tee

am 07.05.2007 14:04:43 von McGeezer (mcgeezer

Hi,

Has anyone got any nice solution to the following problem?

Consider the following line of shell...

$ echo "Hello" |tee -a output.log 2>&1

What I want to do is get the result ($?) from the "echo Hello"
command. If I test for $? after the tee I get the
result of the tee command rather than the echo.

I've tried a few things but hav'nt been able to get it to work
properly.

The OS is AIX 5.2 using a Korn shell.

Any help appreciated.

Cheers,




--
--------------------------------- --- -- -
Posted with NewsLeecher v3.8 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Re: Getting the result of a command that is piped to tee

am 07.05.2007 14:30:33 von Ed Morton

mcgeezer@thepub wrote:

> Hi,
>
> Has anyone got any nice solution to the following problem?
>
> Consider the following line of shell...
>
> $ echo "Hello" |tee -a output.log 2>&1
>
> What I want to do is get the result ($?) from the "echo Hello"
> command. If I test for $? after the tee I get the
> result of the tee command rather than the echo.
>
> I've tried a few things but hav'nt been able to get it to work
> properly.
>
> The OS is AIX 5.2 using a Korn shell.
>
> Any help appreciated.
>
> Cheers,

That's in the FAQ, http://home.comcast.net/~j.p.h/cus-faq.html.

Ed.