Looping through each element in an array in bash