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

Re: jobs numbers in prompt



[16 Jan, @15:07 CET, Miek Gieben wrote in "Re: jobs numbers in prompt ..."]
> [16 Jan, @14:31 CET, Mikael Magnusson wrote in "Re: jobs numbers in prompt ..."]
> > Does this work?
> > myjobs=();for a (${(k)jobstates})
> > {j=$jobstates[$a];myjobs+=($a"${${(@s,:,)j}[2]}")};myjobs=${(j:,:)myjobs}
> 
> whooa! :-) it does work.

fyi: it needed one small tweak, if you have more than 2 bg jobs:

    myjobs=()
    for a (${(k)jobstates})
    {j=$jobstates[$a];i="${${(@s,:,)j}[2]}"
    myjobs+=(a${i//[^+-]/})}
#              ^^^^^^^^^^^^^^
#        filter out anything but + or -
    myjobs=${(j:,:)myjobs}


--
grtz,
 - Miek                               
 GPG Key ID: 3880 D0F6                           http://www.miek.nl/

Attachment: signature.asc
Description: Digital signature



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