2025年12月22日(月) 22:40 Greg Wooledge <[email protected]>:
> On Mon, Dec 22, 2025 at 10:46:12 +0800, 王伟 wrote:
> > Is this behavior intentional design, or is it considered a bug / limitation
> > of associative array assignment?

I believe « declare -A assoc=("${kv[@]}") » should be supported [where
kv is an indexed array in the form kv=(key1 value1 key2 value2 ...)].

> This came up just two weeks ago, in the thread starting at
> <https://lists.gnu.org/archive/html/bug-bash/2025-12/msg00026.html>.

That thread discussed a slightly different behavior: The OP of that
thread expected "[x]=y" in the results of shell expansion to be
treated as assignments like « [key]=value ».

However, the present report discusses whether "key1 value1 key2 value2
..." in the results of shell expansion should be subject to word
splitting and cause the assignments of « [key1]=value1 [key2]=value2
».

> I constructed an example very similar to yours, and Chet's response
> is here: <https://lists.gnu.org/archive/html/bug-bash/2025-12/msg00032.html>

It's similar, but it seems slightly different. The present report
seems to discuss a different point. « declare -A aa="( "${kv[@]}" )"»
and « declare -A aa=( "${kv[@]}" ) » are different.

--
Koichi

  • Question about... 王伟
    • Re: Quest... Greg Wooledge
      • Re: Q... Koichi Murase
        • R... Greg Wooledge
          • ... Zachary Santer
            • ... Greg Wooledge
          • ... Koichi Murase
            • ... Koichi Murase
          • ... Félix Hauri via Bug reports for the GNU Bourne Again SHell
            • ... Greg Wooledge
              • ... Félix Hauri via Bug reports for the GNU Bourne Again SHell
                • ... Félix Hauri via Bug reports for the GNU Bourne Again SHell
                • ... Greg Wooledge

Reply via email to