Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7693619
  • 博文数量: 637
  • 博客积分: 10265
  • 博客等级: 上将
  • 技术积分: 6165
  • 用 户 组: 普通用户
  • 注册时间: 2004-12-12 22:00
文章分类

全部博文(637)

文章存档

2011年(1)

2010年(1)

2009年(3)

2008年(12)

2007年(44)

2006年(156)

2005年(419)

2004年(1)

分类:

2006-04-04 00:04:13

From: Bash FAQ

D5) How can I pipe standard output and standard error from one command to
    another, like csh does with `|&'?

Use
        command 2>&1 | command2
The key is to remember that piping is performed before redirection, so
file descriptor 1 points to the pipe when it is duplicated onto file
descriptor 2.

From Csh man page:
       Diagnostic output may be directed through a pipe with the standard out-
       put.  Simply use the form `|&' rather than just `|'.

       The  shell  cannot  presently  redirect  diagnostic output without also
       redirecting standard output, but `(command  >  output-file)  >&  error-
       file'  is often an acceptable workaround.  Either output-file or error-
       file may be `/dev/tty' to send output to the terminal.

原来csh用 |& 一直不知道。

阅读(5419) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~