Subject: Re: correct shell behaviour?
To: NetBSD Userlevel Technical Discussion List <tech-userlevel@NetBSD.ORG>
From: David Laight <email@example.com>
Date: 08/11/2002 21:14:13
> Before I read the other replies and confuse myself I'm going to reply
> directly and say that I believe the final '$?' should expand to '3'
> since the most recent command list is '(exit 3)'. It is my
> understanding that command-line substitution does not count as a
> The wording in the pdksh manual doesn't help though...
> SuSv2 says nothing about the exit status of a list run in a command
> substitution expansion and by implication one must assume it is
> discarded (since everywhere else the disposition of the exit status is
> explicitly documented).
Ok then what about:
$ (exit 2)
$ a=`echo a; exit 3`
$ echo $?
The expectation here is that $? refers to the `` pipeline.
ie it is possible to test the result of such items.
David Laight: firstname.lastname@example.org