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

Re: Dynamic parameters for PROMPT_SUBST functions



Am Freitag, den 19. Juni 2020 um 13:04 schrieb Daniel Shahaf:
Sebastian Stark wrote on Fri, 19 Jun 2020 08:32 +0200:
I am trying to have a function call in my prompt that gets the return
value of the last command as a parameter (%?).

What would you do with «%?» if you could get its value?

I would try to split it into signal and return value information, so I do not get "130" if I ctrl-c, but something like 0 and INT.

In this example I write the parameter to a file, because if I just print
it it would get printed as a literal %? and expanded later and thus hide
the issue I am facing

You could also print to /dev/tty.

That's at least something I can take away from this, thanks :)


Sebastian



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