Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] (?) typeset array[position=index]=value



While we're at it, could we fix:

assoc[]=x
unset 'assoc[]'
etc.

The former can be worked around with assoc[${-+}]=x or
assoc+=('' x), the latter not AFAICT.

See also

worker:43269
https://unix.stackexchange.com/questions/626393/in-zsh-how-do-i-unset-an-arbitrary-associative-array-element/626529#626529

unset -k "$key" assoc_or_array

or:

assoc[$key]=()

Would probably make sense to fix the issue with escaping \ and ]
bytes in there unless we're happy to break backward
compatibility and make unset "assoc[$key]" work whatever the
value of $key (unset 'assoc[f\]oo]]' for unset the element of
key 'f\]oo]' for instance)

-- 
Stephane




Messages sorted by: Reverse Date, Date, Thread, Author