bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: @K transformation


From: Koichi Murase
Subject: Re: @K transformation
Date: Thu, 19 Aug 2021 19:59:12 +0900

2021年8月19日(木) 19:37 Léa Gris <lea.gris@noiraude.net>:
> Current implementation of @K is pretty-much useless for the dialog use-case:
>
> > #!/usr/bin/env bash
> >
> > declare -A assoc=(
> >   [P]=piano
> >   [TB]='foldable table'
> >   ['CH AIR']=chair
> > )
> >
> > options=("${assoc[@]@K}")

I this particular case, you can instead write

  declare -a "options=(${assoc[@]@K})"

though I agree that the behavior of zsh's ${(kv)assoc} (i.e.,
expanding to separate words) is more useful.  It's too late to change
the behavior of @K so maybe the new behavior can be assigned to @k if
it is worth implementing in Bash.

--
Koichi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]