bug-bash
[Top][All Lists]
Advanced

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

zsh style associative array assignment bug


From: Eric Cook
Subject: zsh style associative array assignment bug
Date: Sat, 27 Mar 2021 17:02:59 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

Hey,

When doing an assignment with an uneven number of elements bash currently 
silently treat the last element
as a key and assigns it an empty string.

$ typeset -A ary=(this feature came from zsh); typeset -p ary
declare -A ary=([came]="from" [this]="feature" [zsh]="" )

In zsh this is an error,
% typeset -A ary=(this feature came from zsh); typeset -p ary
zsh: bad set of key/value pairs for associative array

Could bash be adjusted to align with zsh in this case?




reply via email to

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