How do I iterate over square brackets type data:
I have written this script:
#!/usr/bin/env bash
# This is a external variable I have in Bash file which has the data already
echo $sample_data_set
for i in "${sample_data_set[@]}"
do
:
echo $i
done
And I need to iterate over $sample_data_set. Am I missing something?
I am getting output:
[ "test1", "test2", "test3", "test4" ]
test.sh: 6: Bad substitution