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

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



Sven Wischnowsky wrote [020530 14:49]:
> Thomas Köhler wrote:
> 
> > ...
> > What I don't understand from "man zshparam":
[...]
> > Why doesn't
> >    ~> echo $jobstates[(K)*]
> > return anything when [...]
> 
> You want (i):
> 
>   % echo $jobstates[(i)*]
>   1 2 ...
> 
> With k and K the *keys* stored in the assoc (as opposed to the *exp*
> given in the subscript) are used as patterns:
> 
>   % typeset -A type
>   % type=('[a-zA-Z]' alpha '[0-9]' digit '[^a-zA-Z0-9]' other)
>   % echo $type[(k)x] $type[(k)4] $type[(k).]
>   alpha digit other

Aaaaahh, silly me. Now I understand :-)

Now, for the original problem... Uhm. Tricky. any better ideas?

jless() {
   typeset -x -A tmpstates
   for i in $jobstates[(I)*] 
   do
      tmpstates[$i]=$jobstates[$i]
   done
   for i in $tmpstates[(I)*]
   do
      echo "[$i]\t$tmpstates[$i]"
   done  | sort -n |  less
   unset tmpstates
}

Ciao,
Thomas

-- 
 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: pgpg0tNSL9Xth.pgp
Description: PGP signature



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