Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: named jobs in RPROMPT
- X-seq: zsh-users 16388
- From: fhml@xxxxxxxxxxxxxxxxxxxxxxx
- To: <zsh-users@xxxxxxx>
- Subject: RE: named jobs in RPROMPT
- Date: Tue, 20 Sep 2011 01:42:56 +0200
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Hey there.
> [...] and then set
>RPROMPT=$(jobfunction) But I get nothing, it seems jobstates is empty
>during prompt generation?
When you do >>PROMPT=$(code)<< then 'code' gets executed and the result is stored in PROMPT. Sometimes that is not what you want. What you probably want is >>PROMPT='$(code)'<<. See the little 's? Those prevent 'code' from being evaluated immediately. Now the code gets evaluated every time the PROMPT is shown.
A simple example where 'code' is 'date'. Lets say its currently 1970-01-01 00:00:00. When you enter >>PROMPT=$(date)<<, '$(date)' gets evaluated immediately, which is the same as if you typed >>PROMPT="1970-01-01 00:00:00"<<. Of course, that will never change. If you use 's, then '$(date)' gets stored in PROMPT - just as you typed it, not evaluated. Now every time PROMPT is evaluated '$(date)' gets evaluated which gives you a brand new date every time your PROMPT is updated.
Greetings :)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author