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

Re: Number of jobs in prompt



On Thu, 18 Oct 2001 23:48:53 +0200, Jesper Holmberg wrote:
> I would like to have the current number of (background) jobs displayed
> in my prompt, but I can't find any variable for this. Would it still be
> possible to achieve this?

The zsh/parameter module provides three job-related associative arrays:
jobdirs, jobtexts and jobstates.

So eg. I load the module:
zmodload -i zsh/parameter

have in my prompt the sequence:
%(1v.(bg %v%).)

and have the following precmd defined:
precmd() { psvar[1]=$#jobtexts; [[ $#jobtexts -eq 0 ]] && psvar[1]=(); }

-- 
Michal Politowski -- mpol@xxxxxxxxxxxxxx
Warning: this is a memetically modified message



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