[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fri, 3 Jan 2003 19:21:16 +0100
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;
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!