In linux we can redirect stdout and stderr or both of them to files. For example:
- Redirect stdout and stderr to two files:
command 1>out 2>err
. By this way, we can separate output and error in two difference files. - Redirect both stdout and stderr to files:
command &>all
. By this way, we can capture the appearance orders of output and error message.
I want to combine the two above command: command 1>out 2>err &>all
, to capture the appearance order of output and error, and separate output and error. But the above command does not work, the out
and err
files are empty. If I reverse the order, the all
file will be empty.
So, is there anyway to combine the two command above as I want?
3>all 1> >(tee out >&3) 2> >(tee err >&3)
– meuh Jul 12 '16 at 09:19all
), because the intermediate calls totee
proceed at their own pace. – Gilles 'SO- stop being evil' Jul 12 '16 at 22:41