Turbo Fredriksson <turbo@tripnet.se> writes:
>> It has to be the other way around (first redirect stdout, then stderr
>> to stdout): 'whatever_binary > file_for_output 2>&1'
> Ahh... But when you do 'whatever_binary 2>&1 | tee file_for_output',
> it works, so I just imagined to put a '>' instead of the '| tee'...
It works for the pipe because you're not actually redirecting standard
out, you're just fitting it into a pipeline. What happens in the two
cases with redirection is:
1. >blah 2&>1 : redirect stdout to blah, redirect stderr to wherever
stdout is going; result stdout and stderr to blah.
2. 2&>1 >blah : redirect stderr to wherever stdout is going, redirect
stdout to blah; result stdout to blah, stderr to wherever stdout
*was* going.
Hope that made sense. :)
Brian.