【问题标题】:Print stdout and stderr in terminal and redirect to 2 different files在终端中打印 stdout 和 stderr 并重定向到 2 个不同的文件
【发布时间】:2021-05-11 12:21:13
【问题描述】:

question 的答案解释了如何将 stdout 和 stderr 打印到终端,同时将它们重定向到文件:

program [arguments...] 2>&1 | tee outfile

如果 stdout 和 stderr 应该在 2 个不同的文件中重定向,如何扩展?

【问题讨论】:

  • 你试过tee outfile outfile2吗?

标签: linux bash stdout stderr


【解决方案1】:

process substitution:

program >(tee stdout.log) 2>(tee stderr.log >&2)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-07-22
    • 2020-05-12
    • 2013-02-15
    • 1970-01-01
    • 2022-12-07
    • 1970-01-01
    • 2011-12-28
    • 1970-01-01
    相关资源
    最近更新 更多