Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bug: $? after empty command
- X-seq: zsh-workers 27113
- From: Eric Blake <ebb9@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: bug: $? after empty command
- Date: Thu, 9 Jul 2009 21:17:03 +0000 (UTC)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <loom.20090709T130223-845@xxxxxxxxxxxxxx> <20090709154124.2cd2a227@news01>
- Sender: news <news@xxxxxxxxxxxxx>
Peter Stephenson <pws <at> csr.com> writes:
> > POSIX requires that the execution of an empty command change $? to 0, as
> > shown here with bash:
> >
> > $ zsh -c 'foo=; false; $foo; echo $?'
> > 1
>
> I'm not aware that that's deliberate shell behaviour, and indeed I
> wouldn't have expected it. It *is* deliberate behaviour that the status is
> not reset simply by hitting return at the interactive prompt, but that's
> actually a different issue, not affected by the following.
Good point about making the behavior dependent on a non-empty command line, and
that the exit status of command substitution is still important. I don't see
your patch in CVS yet, so I haven't played with it. But just from inspection,
it looks like it does not cover these related issues, which are both required by
POSIX to output 0:
$ zsh -c 'false; . /dev/null; echo $?'
1
$ zsh -c 'false; ``; echo $?'
1
--
Eric Blake
Messages sorted by:
Reverse Date,
Date,
Thread,
Author