[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Why bash does not recoganize array type smartly?
From: |
Stephane Chazelas |
Subject: |
Re: [Help-bash] Why bash does not recoganize array type smartly? |
Date: |
Wed, 16 Mar 2016 15:24:14 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
2016-03-16 13:39:11 +0000, Dan Douglas:
[...]
> Also as I mentioned - without a built-in zip/unzip function or any way
> to directly get the keys/values at once, you have to write that
> function yourself, which requires at least a few loops that negate the
> purpose of having alternating keys/values in assignments.
[...]
In zsh:
${(k)hash} gives you the keys
$hash or ${(v)hash} gives you the values
${(kv)hash} gives you keys and values zipped
keys=(foo bar)
values=(12 5)
h=(${keys:^values})
to zip.
There are a lot of other ${(flags)parameter}. That tries to
give a more consistent approach than separate operators of
different shapes not easy to cumulate (like ${!var},
${var,asd}...), though zsh already ran out of letters for them...
You have such flags at different levels in zsh
(*(globqualifier), ${(flag)var}, $var[(flag)key], not to mention
csh style $var:modifiers), it takes years of practice to
remember them all. But if you're a vim user, you're used to it
;-).
--
Stephane
- [Help-bash] Why bash does not recoganize array type smartly?, Peng Yu, 2016/03/09
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Chris F.A. Johnson, 2016/03/10
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Chet Ramey, 2016/03/10
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Dan Douglas, 2016/03/15
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Stephane Chazelas, 2016/03/15
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Dan Douglas, 2016/03/15
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Greg Wooledge, 2016/03/16
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Dan Douglas, 2016/03/16
- Re: [Help-bash] Why bash does not recoganize array type smartly?,
Stephane Chazelas <=
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Chet Ramey, 2016/03/17
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Stephane Chazelas, 2016/03/16
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Dan Douglas, 2016/03/16
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Chet Ramey, 2016/03/16
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Dan Douglas, 2016/03/16
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Stephane Chazelas, 2016/03/16
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Dan Douglas, 2016/03/16
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Greg Wooledge, 2016/03/16
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Dan Douglas, 2016/03/16
- Re: [Help-bash] Why bash does not recoganize array type smartly?, Stephane Chazelas, 2016/03/17