[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bash Manual section 6.7 Arrays should mention array append notation
From: |
Zachary Santer |
Subject: |
Bash Manual section 6.7 Arrays should mention array append notation |
Date: |
Tue, 8 Mar 2022 10:55:15 -0500 |
$ 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
- Bash Manual section 6.7 Arrays should mention array append notation,
Zachary Santer <=