From owner-freebsd-questions Tue May 30 13:42:42 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id AA98E37B8FA for ; Tue, 30 May 2000 13:42:31 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id PAA09693; Tue, 30 May 2000 15:42:28 -0500 (CDT) (envelope-from dan) Date: Tue, 30 May 2000 15:42:28 -0500 From: Dan Nelson To: Archie Cobbs Cc: freebsd-questions@FreeBSD.ORG Subject: Re: basic sh(1) question Message-ID: <20000530154228.C3419@dan.emsphone.com> References: <200005302013.NAA33987@bubba.whistle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <200005302013.NAA33987@bubba.whistle.com>; from "Archie Cobbs" on Tue May 30 13:13:00 GMT 2000 X-OS: FreeBSD 5.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (May 30), Archie Cobbs said: > 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. -- Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message