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

precmd not being updated when I want



I have this:

precmd() { psvar[1]=$#jobtexts; [[ $#jobtexts -eq 0 ]] && psvar[1]=0; }
PS1="%(1v.%v .)$cpath${end}%# "

which gives me the number of jobs first in my prompt. It works very well.
However, if a job finishes, the number of jobs in the prompt does not
update until I type a new command and hit <enter>. Thus:

0 jesper@strindberg:~% sleep 1 &
[1] 7392
1 jesper@strindberg:~% 
[1]  + done       sleep 1
1 jesper@strindberg:~% 
0 jesper@strindberg:~% 

Notice how sleep reports it is finished, but the prompt still shows "1".
Only when I hit <enter> on the second to last line, the "1" is turned into
a "0". Is there a way to fix this?

TIA,

Jesper



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