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) |