Subject: Re: bin/17870: /bin/sh bug on expanding $? in here-documents
To: David Laight <firstname.lastname@example.org>
From: Andrew Brown <email@example.com>
Date: 08/08/2002 10:12:36
> ! :
> for f in $? `echo $?` $? `echo $?`
> echo $f
>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.
i would also expect that repeated instances of $? in a command line
should all be the same since no other variables change over the course
of command line interpretation.
|-----< "CODE WARRIOR" >-----|
firstname.lastname@example.org * "ah! i see you have the internet
email@example.com (Andrew Brown) that goes *ping*!"
firstname.lastname@example.org * "information is power -- share the wealth."