当前位置: 动力学知识库 > 问答 > 编程问答 >

bash - Unix: Is it possible to copy error output to a file while still displaying all output?

问题描述:

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
分享给朋友:
您可能感兴趣的文章:
随机阅读: