Subject: Re: bin/17870: /bin/sh bug on expanding $? in here-documents
From: David Laight <firstname.lastname@example.org>
Date: 08/08/2002 15:26:36
On Thu, Aug 08, 2002 at 10:12:36AM -0400, Andrew Brown wrote:
> >I meant
> > ! :
> > for f in $? `echo $?` $? `echo $?`
> > do
> > echo $f
> > done
> >Anyone any idea where the `echo $?` gets its value from?
> >That code outputs 1 0 1 0!
> my guess would be that since the `` bits execute in subshells which
> haven't had any children exit yet, the only reason thing they can
> print would be 0.
echo $(echo $?)
should output the same as:
David Laight: email@example.com