【发布时间】:2015-06-02 01:37:31
【问题描述】:
正在使用 time 命令运行带有 stderr 的应用程序。我希望将应用程序的输出重定向到 /dev/null,将 stderr 重定向到日志,并将时间重定向到日志。
执行命令:
time cmd args >/dev/null 2>log
重定向 cmd,但不重定向带有计时的 time 命令。
【问题讨论】:
-
在 SO 上搜索 '
[bash] time output' 会发现许多可能的重复项,包括timeoutput redirection、Bashtimeoutput processing(这三个中最古老的)和 Is there a way to redirecttimeoutput to file in Linux?。 -
@JonathanLeffler 有什么特别的原因你没有提名关闭作为其中之一的副本?
-
@tripleee:主要是我不相信我有一个规范的副本。我列出的三个中最早的一个的答案不是很好。那里可能还有其他更好的副本。我也需要看看你发现了什么。我生活在希望其他人会努力找到一个非常好的副本。作为 Mjölnir 的持有者,我必须非常小心。