Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 May 2000 14:42:57 -0700 (PDT)
From:      Archie Cobbs <archie@whistle.com>
To:        dnelson@emsphone.com (Dan Nelson)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: basic sh(1) question
Message-ID:  <200005302142.OAA76390@bubba.whistle.com>
In-Reply-To: <20000530154228.C3419@dan.emsphone.com> from Dan Nelson at "May 30, 2000 03:42:28 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Dan Nelson writes:
> > In sh(1), how do I make both the stdout and stderr output of a command
> > get piped together into another command?
> > 
> > For output to a file, you do this:
> > 
> >   $ cmd1 >file 2>&1 
> > 
> > So you'd think the same thing would work for output to another command,
> > but it doesn't:
> > 
> >   $ cmd1 |cmd2 2>&1 
> 
> That line redirects stderr to stdout for "cmd2", since the redirection
> is after the command. "cmd1 2>&1 | cmd2" should do what you want. 

Hmm... kindof non-intuitive though, eh? Because doing this doesn't work:

	$ cmd1 2>&1 >file

Oh, whatever.. in any case, thanks for the help.

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200005302142.OAA76390>