The += operator appeared in Bash version 3.1.
In older versions, if the array is not sparse, you can either assign to the element after the array's last element:
NODES[${#NODES[@]}]="$WAS_IP"If you append new values in one certain place, you may use a separate counter variable:
NODES=() NODES_length=0 NODES[NODES_length++]="$WAS_IP"But this is just moderately faster than asking the array's length with
${#NODES[@]}.Or you can assign the whole array to the existing elements and the new one:
NODES=("${NODES[@]}" "$WAS_IP")Needless to say, better avoid this laterlatter one. If the array was initially sparse, the array indices will have changed after that assignment.