【问题标题】:writing screen output (stdErr) and output (stdOut) of a Linux command to separate files将 Linux 命令的屏幕输出 (stdErr) 和输出 (stdOut) 写入分隔文件
【发布时间】:2019-06-02 00:47:20
【问题描述】:

我正在使用命令行包并在我使用的文件中获取它的输出:

my_command > outfile

但它在运行并将输出写入输出文件时也会在屏幕上产生一些信息,我希望在第二个输出文件中获取屏幕输出。在 here 的有用线程中,没有建议的方法来分隔这两个输出。实际上有没有办法将这两个输出分开并将它们写入不同的文件中?

【问题讨论】:

标签: linux output


【解决方案1】:

听起来附加输出来自stderr,您可以使用2> 捕获:

mycommand > outfile 2> stderr

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-26
    • 1970-01-01
    • 2019-06-14
    • 1970-01-01
    • 2012-02-18
    • 2017-12-01
    相关资源
    最近更新 更多