Bash - 输出重定向
我试图将错误输出重定向到文件和终端并丢弃标准输出,但我无法弄清楚。有人知道该怎么做吗?
I'm trying to redirect error output to both a file and the terminal and throw away standard output, but I can't figure it out. Does anybody know how to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
STDOUT 被黑洞进入 /dev/null
STDERR 被重定向到 STDOUT
tee 接收 STDOUT 并重新回显它并将其写入文件
STDOUT gets black-holed into /dev/null
STDERR gets redirected to STDOUT
tee receives STDOUT and re-echoes it as well as writing it to file
请参阅这篇文章。您将需要使用 tee 命令来定向多个方向。
http://www.linuxforums .org/forum/programming-scripting/163161-redirecting-stdout-file-terminal-stderr-file.html
See this post. You will need to use the tee command to direct in multiple directions.
http://www.linuxforums.org/forum/programming-scripting/163161-redirecting-stdout-file-terminal-stderr-file.html