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

Problems with escaped close parens in ternary expressions in PROMPT string



I have my PROMPT variable set to:
    PROMPT='%B%m%b%0(#. (root\).)%0(?.. (last code exit status was %?\)): '

When commands complete with a nonzero exit status, I get:
  altair-4): foo                                                             
                                ~
  zsh: command not found: foo
  altair-4 (last code exit status was 1\):

Whereas commands that complete with a zero exit status give me:
  altair-4): echo foo                                                         ~
  foo
  altair-4):                                                                 
                                ~

I thought perhaps there's some reason why I would NOT have to escape the  
first of the two adjacent closing parens, so I tried:
    PROMPT='%B%m%b%0(#. (root\).)%0(?.. (last code exit status was %?)): '

With that change a nonzero exit status gives me:
  altair-4): foo                                                             
                                ~
  zsh: command not found: foo
  altair-4 (last code exit status was 1):                                    
                                ~
which is exactly what I want, but a zero exit status still gives me:
  altair-4 (last code exit status was 1): echo foo                           
                                ~
  foo
  altair-4):                                                                 
                                ~

I am presently seeing this on both NeXTSTEP 3.3 and IRIX 5.3, with both  
systems running zsh 2.6-beta13.

This problem was not present on the IRIX 5.3 system before I upgraded the  
zsh there to zsh-2.6beta13 -- it was running zsh-2.6-beta5 and didn't have  
the problem.  So has something changed in the ternary expression handling  
code for PROMPT sequences since beta5 that would explain this problem?

Thanks.

--joseph

(ps: please email to me directly as I am no longer on zsh-users or zsh-workers.)

pps: the tilde characters you see are from RPROMPT='%B%U%~%u%b' -- that's  
my homedir hanging out on the right hand edge of the screen, wrapping in  
this email message.




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