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
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?