Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 May 2000 15:42:28 -0500
From:      Dan Nelson <dnelson@emsphone.com>
To:        Archie Cobbs <archie@whistle.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: basic sh(1) question
Message-ID:  <20000530154228.C3419@dan.emsphone.com>
In-Reply-To: <200005302013.NAA33987@bubba.whistle.com>; from "Archie Cobbs" on Tue May 30 13:13:00 GMT 2000
References:  <200005302013.NAA33987@bubba.whistle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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