Subject: Re: redirection within sh-like shells
To: None <tech-userlevel@netbsd.org>
From: Jan Schaumann <jschauma@netmeister.org>
List: tech-userlevel
Date: 08/15/2002 11:15:45
Aymeric Vincent <Aymeric.Vincent@labri.fr> wrote:
> 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.
Hmmm, indeed:
# sh 2>/dev/null
blah >/dev/null
exit
#
# sh
$> exec blah >/dev/null 2>&1
# sh
$> exec blah >/dev/null
exec: blah: not found
#
> So it seems semantically correct to me.
So ksh and bash are wrong, then? Interesting.
-Jan
--
Discourage inbreeding - ban country music