Subject: Re: Unixism, pipes and pkgsrc
To: Steven M. Bellovin <smb@cs.columbia.edu>
From: Johnny Billquist <bqt@softjar.se>
List: netbsd-users
Date: 08/23/2007 09:26:16
Steven M. Bellovin skrev:
> Let me add one more complexity: pipes.  If you want to send stderr in
> to the pipe, you have to put the 2>&1 before the pipe:
> 
> 	foo 2>&1 | bar
> 
> If you write 
> 
> 	foo | bar 2>&1
> 
> it will affect stderr for bar, not foo.

That can't be right, can it?
I would have thought it would be

foo | 2>&1 bar

The first example would be evaluated the same as mentioned before. stderr 
becomes a copy of stdout, and then you redirect stdout. That won't affect stderr.

But I might be totally wrong here. I don't use sh myself, so I'm no expert... 
When it gets too complicated, I change to tcsh instead, in which I have a better 
understanding how things happen...

	Johnny

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: bqt@softjar.se             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol