Subject: Re: bin/17870: /bin/sh bug on expanding $? in here-documents
To: <>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 08/08/2002 17:34:24
> >but:
> > echo $(echo $?)
> >should output the same as:
> > echo $?
>
> i'm not convinced of that. do you have a reference to some standard
> that covers this, or is this just what seems right to you?
The 'subshell' inherits everything from the main shell.
This was fixed a few years ago (look at the CVS history for eval.c).
For another one, how about:
(exit 3); eval echo $(echo \$?)
netbsd 'sh' outputs 0, but pdksh outputs 3.
The version I'm playing with now treats `...` differently from $(...)
David
--
David Laight: david@l8s.co.uk