construct
Bash array append
Appends values beyond the greatest assigned index of an indexed array, or at zero if empty.
Formal Syntax & Structure
bash syntaxbash
name+=(value ...)Return Value
exit status
Appends values beyond the greatest assigned index of an indexed array, or at zero if empty.
Working Example
Example Snippetbash
items=([0]=a [4]=b)items+=(c 'd e')for i in "${!items[@]}"; do printf '%s:%s\n' "$i" "${items[i]}"; done