开发者

Bash - output redirection

I'm trying to redirect error output to both a file and the terminal and throw away stand开发者_如何学Card output, but I can't figure it out. Does anybody know how to do it?


myCommand 2>&1  1>/dev/null | tee /path/to/some/file.txt

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜