On Mon, Dec 22, 2025 at 10:46:12 +0800, 王伟 wrote:
> But when using runtime assignment:
> 
> local -A params=("$@")
> 
> or:
> 
> declare -A params=("${array[@]}")
> 
> Bash does not interpret the arguments as key/value pairs, and instead
> produces something like:
> 
> declare -p params
> declare -A params=(["a 1 b 2"]="")
> 
> My question is:
> 
> Is this behavior intentional design, or is it considered a bug / limitation
> of associative array assignment?
> 
> If this is intentional, could you clarify why runtime assignment does not
> follow the same key/value parsing rules as literal initialization?

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

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>

  • 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

Reply via email to