Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1140062
  • 博文数量: 153
  • 博客积分: 10576
  • 博客等级: 上将
  • 技术积分: 2137
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-02 21:01
文章分类

全部博文(153)

文章存档

2009年(43)

2008年(110)

分类: LINUX

2008-07-18 10:02:48

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 
阅读(662) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~