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

Re: Dynamic parameters for PROMPT_SUBST functions



Hi Sebastian,

> On Jun 19, 2020, at 2:32 AM, Sebastian Stark <sstark+zsh@xxxxxxxxxxx>
> wrote:
> 
> I am trying to have a function call in my prompt that gets the
> return value of the last command as a parameter (%?).
> 
> However I am having trouble to get this right. Instead of an actual
> number, what is handed to the function is the literal string %?.

Yes, that is because the PROMPT_SUBST expansions (parameter, command,
and arithmetic) are done before the percent-escape sequences are
expanded.

vq



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