[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: K. Posern
Subject: question
Date: Fri, 3 Jan 2003 19:21:16 +0100
User-agent: Mutt/1.4i


I have a question which I didn't found any answer yet!
And I searched the web a lot!

topics: advanced I/O redirection AND return value:

I want to redirect stderr to stdout,
AND redirect stderr AND stdout to a file!

I found a nearby solution:

echo "stderr to stdout AND both (stderr AND stdout to _both-3!";
$CMD 2>&1 >>_both-3| tee -a _both-3 1>&2;
echo "RESULT='$RESULT'";

This was the only way I found to DUPLICATE a filehandle - 
redirect everything wrote to stdout to TWO different destinations.

The only PROBLEM is, that the RETURN value is now always 0, 
cause tee is always doing fine also $CMD may FAIL!!

But I NEED the return value of CMD!!!

And thus CMD is a cdburning command I can't make something like a
testrun of CMD to evaluate the return value.

Do you have any idea how I may achieve both goals
(do the io-redirection AND get the return value)

Or whom may I ask instead?
(I was on the gnu bash homepage and didn't found anything better
than this email-address)

Any help/hint on this would be very apreciated!!!

Thnx in advance for any answer!

Greetings and happy new year!

Knuth Posern.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]