What is /dev/null 2>&1?

>> /dev/null redirects standard output (stdout) to /dev/null, which discards it.

(The >> seems sort of superfluous, since >> means append while > means truncate and write, and either appending to or writing to /dev/null has the same net effect. I usually just use > for that reason.)

2>&1 redirects standard error (2) to standard output (1), which then discards it as well since standard output has already been redirected.

 

 

转自: http://stackoverflow.com/questions/10508843/what-is-dev-null-21

posted @ 2016-03-18 11:34  圆旭  阅读(174)  评论(0编辑  收藏  举报