From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2267 invoked from network); 15 Jun 2003 14:04:26 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 15 Jun 2003 14:04:26 -0000 Received: (qmail 5099 invoked by alias); 15 Jun 2003 14:04:12 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6165 Received: (qmail 5090 invoked from network); 15 Jun 2003 14:04:11 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 15 Jun 2003 14:04:11 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [213.67.148.76] by sunsite.dk (MessageWall 1.0.8) with SMTP; 15 Jun 2003 14:4:11 -0000 Received: (qmail 74195 invoked by uid 1001); 15 Jun 2003 14:04:10 -0000 Date: Sun, 15 Jun 2003 16:04:10 +0200 From: Erik Trulsson To: zsh-users@sunsite.dk Subject: Re: How to redirect stderr to a pipe and stdout to a file? Message-ID: <20030615140409.GA66999@falcon.midgard.homeip.net> Mail-Followup-To: zsh-users@sunsite.dk References: <20030615125030.GA4042@s.chello.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030615125030.GA4042@s.chello.no> User-Agent: Mutt/1.5.4i On Sun, Jun 15, 2003 at 02:50:30PM +0200, Haakon Riiser wrote: > In bash, I could always do > > $ ls INVALID . 2>&1 >/dev/null | less > > to send stderr: > > ls: INVALID: No such file or directory > > to the less buffer and stdout to /dev/null. When I use the > same command in zsh 4.0.6, _both_ stderr and stdout is sent > to less. If I remove "| less" from the command, it works as it > should: stdout is discarded and stderr is sent to the terminal. > I've looked through the chapter on redirection in zshmisc(1), > but I couldn't find an answer. (Of course, that doesn't mean > it's not there. :-) > > Thanks in advance for any help. I don't know what the real answer is, but a workaround (which should also work in bash) is to execute the first command in a subshell, i.e: ( ls INVALID . 2>&1 >/dev/null ) | less -- Erik Trulsson ertr1013@student.uu.se