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

Re: $? being clobbered?



On Mon, 14 Jul 2003 13:35:56 -0400, Phil!Gregory wrote:
> I'm having a problem with zsh, and am not sure if it's a bug or a
> feature.  If I have a program executed in my prompt, its return status
> clobbers the value of $?, which isn't really what I want.  Example:
> 
> > PROMPT='> '
> > perl -e 'exit 42'
> > echo $?
> 42
> > PROMPT='%{$(echoti cub 80)%}> '
> > perl -e 'exit 42'
> > echo $?
> 0
> 
> Is there some way to fix this?

You can hack around this with
$(R=$?;echoti cub 80;return $R)

-- 
Michał Politowski -- mpol@xxxxxxxxxxxxxxxxxxx
Warning: this is a memetically modified message



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