Tekkaman

导航

 

linux数据重定向&管道

 1、linux数据重定向。

#将错误输出信息关闭掉
[chengmo@centos5 shell]$ ls test.sh test1.sh 2>&-
test.sh
[chengmo@centos5 shell]$ ls test.sh test1.sh 2>/dev/null
test.sh
#&[n] 代表是已经存在的文件描述符,&1 代表输出 &2代表错误输出 &-代表关闭与它绑定的描述符
#/dev/null 这个设备,是linux 中黑洞设备,什么信息只要输出给这个设备,都会给吃掉 

  参考:http://www.cnblogs.com/chengmo/archive/2010/10/20/1855805.html

 2、linux管道。

  参考:http://www.cnblogs.com/chengmo/archive/2010/10/21/1856577.html

posted on 2013-04-16 16:17  Tekkaman  阅读(227)  评论(0编辑  收藏  举报