On 1/8/09 9:36 AM, John McKown wrote:
Is there any better way, in a bash script, to pipe both stdout and stderr
from an application other than using a subshell? So far the only way that
I've thought of to do it is:

(command parm1 ... 2>&1) | othercommand


Others have answered the question, but in case you want to know -- the
technique (not the syntax!) you're using with the subshell is required
in csh and derivative shells (e.g., tcsh). From the tcsh man page:

       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.

You may have picked up the habit from too much exposure to Solaris? ;-)

- Larry

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to