Re: Question about associative array runtime assignment vs literal initialization
Zachary Santer <[email protected]>
| Newsgroups | gmane.comp.shells.bash.bugs |
|---|---|
| Message-ID | <CABkLJUK+pAmh=o-5ZpuFb2vCC6p0nURNacF5iSogB3+F2USdTg@mail.gmail.com> |
On Mon, Dec 22, 2025 at 10:21 AM Greg Wooledge <[email protected]> wrote: > > The only known workaround is to abandon this approach entirely, and use > @K plus eval instead. Think the OP would want the @Q parameter transformation in this case, actually. $ declare -a array=(a 1 b 2) $ eval "declare -A params=( ${array[@]@Q} )" $ declare -p params declare -A params=([b]="2" [a]="1" ) > Both of these are "wrong" from the point of view of everybody but Chet. > It doesn't appear this is going to change. Maybe there's a new angle to take here. Why would a shell programmer want the current behavior, Chet?