Re: Inconsistent behaviour of +=() and existing array keys

2014-11-29 Thread helmut . karlowski
On Fri, Nov 28, 2014 at 03:47:49PM -0500, Maarten Billemont wrote: least for the associative arrays case, because in the case of normal arrays, ksh93 does some pretty funny things: | dualbus@hp ~ % ksh93 -c 'a=(); a+=([0]=b); typeset -p a' | typeset -A a=([0]=b) # Ha! Now 'a' is an associative

Re: Inconsistent behaviour of +=() and existing array keys

2014-11-29 Thread Chet Ramey
On 11/29/14 4:47 AM, Eduardo A. Bustamante López wrote: > > Further expanding on this: Thanks, this is the right fix. And it works for indexed arrays as well, making the behavior consistent. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vit

Re: Inconsistent behaviour of +=() and existing array keys

2014-11-29 Thread Eduardo A . Bustamante López
On Fri, Nov 28, 2014 at 03:47:49PM -0500, Maarten Billemont wrote: > What I would expect is for += inside +=() to behave as = does now, and = to > behave as it does outside of +=(), which is to "set" the value, not > append. Ergo: > > declare -a indexed_array=( [0]=a ) > indexed_array=( [0]=b ) #

Inconsistent behaviour of +=() and existing array keys

2014-11-28 Thread Maarten Billemont
So, referring to man bash, this is the description of +=: When += is applied to an array variable using compound assignment (see Arrays below), the variable's value is not unset (as it is when using =), and new values are appended to the array beginning at one greater than the array's maximum