If you are not familiar with arrays, check out our article Getting Started with Arrays in Bash Shell Scripting.
Let's say you have an array of fruit.
fruit=(banana apple orange grapes)
The += operator can be used to append values to the array. In this example, pineapple is appended to the fruit array.
fruit+=(pineapple)
Here is how to print every element in the array.
echo ${food[*]}
Which should return the following.
apple banana orange grapes pineapple
Or, a for loop can be used to iterate over each item in the array, like this.
for item in ${fruit[@]}; do
echo $item
done
Which should return the following.
apple
banana
orange
grape
pineapple