Re: Question about associative array runtime assignment vs literal initialization

Chet Ramey <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Organization ITS, Case Western Reserve University
Message-ID <[email protected]>
On 12/22/25 10:01 AM, Koichi Murase wrote:
> 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 ...)].

https://lists.gnu.org/archive/html/bug-bash/2025-12/msg00030.html

explains why this doesn't happen. It seems like you want a different
order of operations.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc (application/pgp-signature, 203 B)
-----BEGIN PGP SIGNATURE-----

wmMEABEIACMWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCaUqrZwUDAAAAAAAKCRC7WGnwZOp0q+0q
AJ0Y79Z3eFN/Aj9TRRHbYUlAUMqyUgCaAk+6yW6Ro1FT0g7Lht2FY9s8OTA=
=Xb3H
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.