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

Re: jobs numbers in prompt



On 16/01/2008, Miek Gieben <miek@xxxxxxx> wrote:
> Hello,
>
> In my current prompt I have a list of background jobs (if there are
> any). This works like this:
>     myjobs=${(pj:\,:)${(k)jobstates}}
>
> And gives a list like: 1,2
>
> Now my question, is there any possibility to include the current job
> (+ sign) and previous job (- sign) in this output? Like this: 1-,2+
>
> Is this possible? If been fighting with $jobstates all week, but I've
> been unable to extract multiple fields from this array.

Does this work?
myjobs=();for a (${(k)jobstates})
{j=$jobstates[$a];myjobs+=($a"${${(@s,:,)j}[2]}")};myjobs=${(j:,:)myjobs}

-- 
Mikael Magnusson



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