Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author


On Sat, Dec 24, 2011 at 6:13 AM, Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> Hi,
> This is not new, but there are two problems with the PRINT_EXIT_VALUE
> option. They can be shown on the following example (under Debian):
> $ zsh-beta -f
> xvii% echo $ZSH_VERSION
> 4.3.15-dev-0-cvs1220
> xvii% setopt PRINT_EXIT_VALUE
> xvii% false || true
> zsh: exit 1
> xvii%

Unrelated to the apparent bug you've described, I've been using a
different mechanism to achieve the effect that (I think) you want. $?
does the right thing:

% false || true ; echo $?
% false && true ; echo $?

You can use the %? sequence in your prompt to see the exit value; what
I do is actually use the following:
%(?// %?? )

This expands to " 1? " after false && true, and the empty string ""
after false || true. I find this really handy as the prompt is
different enough to draw my attention after a non-zero exit status.

Hope this helps,

Messages sorted by: Reverse Date, Date, Thread, Author