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

Re: fg jobs info



[On 05 Sep, @13:34, Matthew Wozniski wrote in "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

ah

> 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

Thank you, this makes it very easy indeeed.


--
grtz,
  - Miek

  http://www.miek.nl
  PGP: 6A3C F450 6D4E 7C6B C23C  F982 258B 85CF 3880 D0F6

Attachment: signature.asc
Description: Digital signature



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