问题描述:

This question already has an answer here:

  • How to redirect output to a file and stdout

    9 answers

网友答案:

If you can have stdout and stderr into the file

command 2>&1 | tee -a log

Else you swap stdout and stderr using 3

{ command | tee stdout.log; } 3>&1 1>&2 2>&3 | tee stderr.log
相关阅读:
Top