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

Re: fg jobs info



On Wed, Sep 05, 2007 at 01:21:41PM +0200, Miek Gieben wrote:
> Is there a way to get the jobnumber from any of these variables. 
> $jobstates includes a lot, but not the actual job number.

Sure it does.  $jobstates, and $jobtexts for that matter, is an
associative array, not a traditionally indexed array.  So, you can
just use ${(k)jobtexts} to find the current job numbers:

mastermind% sleep 50 &
[1] 26864
mastermind% sleep 100 &
[2] 26865
mastermind% sleep 20 &
[3] 26866
mastermind% kill %2
mastermind%
[2]  - terminated  sleep 100
mastermind% echo ${(k)jobstates}
1 3

~Matt



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