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

Re: fg jobs info



Miek Gieben <miek@xxxxxxx>:
> [On 05 Sep, @11:28, Peter Stephenson wrote in "Re: fg jobs info ..."]
> > Atom Smasher wrote:
> > > maybe in the process of working out the bugs, there can be some added 
> > > functionality to add a variable that automagically returns the text of the 
> > > fg'd job.
> > 
> > That's $jobtexts.
> 
> Is there a way to get the jobnumber from any of these variables. 
> $jobstates includes a lot, but not the actual job number.
> (I want to list the current job numbers in my prompt - if there are
> any)

[snip]
% sleep 60 & sleep 15 & ; sleep 1 ; sleep 60 &
    (wait until 3 sleeps are in the background)
% print -l ${(kv)jobtexts}
1
sleep 60
2
sleep 15
3
sleep 60
    (wait for sleep 15 to stop)
[2]  - 17090 done       sleep 15
% print -l ${(kv)jobtexts}
1
sleep 60
3
sleep 60
[snap]

So, print ${(k)jobtexts} should give you the information you want,
I think.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925



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