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

$jobstates (Re: zsh: Strange feature with 'jobs' commmand)


Björn Johannesson wrote [020530 14:12]:
> Hi.
> If you start a few jobs in the background and do:
> zsh% jobs
> [1]  - running    xmixer
> [2]  + running    gtcd
> zsh% _
> ok, this is expected but this is not...
> zsh% jobs | less
> (END)
> zsh% _
> Why? This is quite annoying. You do not get any output if you pipe the
> results from the "jobs" command. (jobs 2>&1|less doesn't work either)

I don't remember exactly why this is the case (you might find
something in the archives), but you can get the information via
the $jobstates associative array.

echo $jobstates | less

What I don't understand from "man zshparam":

       k      If  used  in  a  subscript on an associative array,
              this flag causes the keys to be interpreted as pat­
              terns,  and  returns  the  value  for the first key
              found where exp is matched by the key.   This  flag
              does  not work on the left side of an assignment to
              an associative array element.  If used  on  another
              type of parameter, this behaves like `r'.

       K      On  an  associative  array  this  is  like  `k' but
              returns all values where  exp  is  matched  by  the
              keys.   On  other  types of parameters this has the
              same effect as `R'.

Why doesn't
   ~> echo $jobstates[(K)*]
return anything when
   ~> echo $jobstates[*]
   running::6179=running running:-:6193=running running:+:6207=running
returns a few jobs?
   ~> echo $jobstates[1]
also works fine. I would suppose
   ~> echo $jobstates[(K)*]
   1 2 3
or something similar...


 Thomas Köhler Email:   jean-luc@xxxxxxxxxxxxxxxxx     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

Attachment: pgp7zjUpvHbvY.pgp
Description: PGP signature

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