Subject: Re: redirection within sh-like shells
To: NetBSD Userlevel Technical Discussion List <tech-userlevel@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: tech-userlevel
Date: 08/15/2002 13:24:52
[ On , August 15, 2002 at 17:00:21 (+0200), Aymeric Vincent wrote: ]
> Subject: Re: redirection within sh-like shells
>
> Jan Schaumann <jschauma@netbsd.org> writes:
> 
> > Klaus Heinz <k.heinz.aug.zwei@onlinehome.de> wrote:
> >  
> > >   $ sh
> > >   $ bla >/dev/null 2>&1
> > >   bla: not found
> > 
> > Given my understanding of shells and redirection, I can not comprehend
> > why 'sh' does _not_ print the error to /dev/null.  It has been
> > instructed to do so.
> 
> Actually, the shell has been instructed to redirect the output of the
> "bla" command to /dev/null. Not its own output.
> 
> So it seems semantically correct to me.

Ah ha!  Yes, that's the logic I was trying to come up with in my head.

ksh et al are indeed wrong -- I just couldn't put the reason into words!

though I was getting close with this example:

	$ sh -c 'blah > /dev/null 2>&1'
	blah: not found

which seemed much closer to illustrating what was going on....

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>