bug-bash
[Top][All Lists]
Advanced

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

Re: Bash Manual section 6.7 Arrays should mention array append notation


From: Zachary Santer
Subject: Re: Bash Manual section 6.7 Arrays should mention array append notation
Date: Thu, 24 Mar 2022 11:12:25 -0400

I'm consulting the online manual
<https://www.gnu.org/software/bash/manual/html_node/index.html>, so if
you're looking for a version number, that would be 5.1.

I just now looked at doc/bash.pdf in the git repo on Savannah. No info on
appending is present under bash-5.2-testing or devel.

Regards.
Zack


On Tue, Mar 8, 2022 at 10:55 AM Zachary Santer <zsanter@gmail.com> wrote:

> $ array=( zero one two )
> $ array+=( three four five )
> $ declare -p array
> declare -a array='([0]="zero" [1]="one" [2]="two" [3]="three"
> [4]="four" [5]="five")'
> $ array=( [0]=zero [1]=one [2]=two )
> $ array+=( [3]=three [4]=four [5]=five )
> $ declare -p array
> declare -a array='([0]="zero" [1]="one" [2]="two" [3]="three"
> [4]="four" [5]="five")'
> $ declare -A assoc_array=( [zero]='0' [one]='1' [two]='2' )
> $ assoc_array+=( [three]='3' [four]='4' [five]='5' )
> $ declare -p assoc_array
> declare -A assoc_array='([four]="4" [one]="1" [five]="5" [zero]="0"
> [two]="2" [three]="3" )'
>
> Talking about the lines with "+=", obviously. I only learned I could
> do this when I found it in existing code.
>
> Regards,
> Zack
>


reply via email to

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