1>/dev/null and 2>/dev/null意义
2009-07-17 20:03
375 查看
A.
1> /dev/null 表示将命令的标准输出重定向到 /dev/null
2>/dev/null 表示将命令的错误输出重定向到 /dev/null
1 - denotes stdout ( standard output )
2 - denotes stderr ( standard error )
/dev/null就相当与windows里的回收站,只是进去了不能再出来了。
>/dev/null 就是将标准输出和标准出错的信息屏蔽不显示
B.
>/dev/null 2>&1 also can write as 1>/dev/null 2>&1
- stdout redirect to /dev/null (no stdout) ,and redirect stderr to stdout (stderr gone as well) . end up it turns both stderr and stdout off
C. a little practice may help to undstand above .
#ls /usr /nothing
#ls /usr /nothing 2>/dev/null
#ls /usr /nothing >/dev/null 2>
1> /dev/null 表示将命令的标准输出重定向到 /dev/null
2>/dev/null 表示将命令的错误输出重定向到 /dev/null
1 - denotes stdout ( standard output )
2 - denotes stderr ( standard error )
/dev/null就相当与windows里的回收站,只是进去了不能再出来了。
>/dev/null 就是将标准输出和标准出错的信息屏蔽不显示
B.
>/dev/null 2>&1 also can write as 1>/dev/null 2>&1
- stdout redirect to /dev/null (no stdout) ,and redirect stderr to stdout (stderr gone as well) . end up it turns both stderr and stdout off
C. a little practice may help to undstand above .
#ls /usr /nothing
#ls /usr /nothing 2>/dev/null
#ls /usr /nothing >/dev/null 2>
相关文章推荐
- Linux Shell 1>/dev/null 2>&1 含义
- Linux Shell 1>/dev/null 2>&1 含义
- Linux Shell 1>/dev/null 2>&1 含义
- ubuntu (标准输出)重定向> 及 等同于 & 的用法 etc:1>/dev/null 2>&1
- Linux下Shell输出重定向到空设备文件1>/dev/null 2>&1
- 1>/dev/null 2>&1的含义
- 1>/dev/null 2>&1的含义
- Linux Shell 1>/dev/null 2>&1 含义
- Linux Shell 1>/dev/null 2>&1 含义
- Difference between 2>&-, 2>/dev/null, |&, &>/dev/null and >/dev/null 2>&1
- Linux Shell 1>/dev/null 2>&1 含义
- Linux Shell 1>/dev/null 2>&1 含义
- shell 1>&2 2>&1 &>/dev/null 重定向汇总
- 1>/dev/null 2>&1的含义
- 1> /dev/null 2>&1
- 标准输出+标准错误输出(1>/dev/null 2>&1)
- What does '>/dev/null 2>&1' mean in this article of crontab basics
- Linux Shell 1>/dev/null 2>&1 含义
- Linux 1>/dev/null 2>&1的含义
- 1>/dev/null 2>&1的含义