I'm trying to generate dynamic var names in a shell script to process a set of files with distinct names in a loop as follows:
SAMPLE1='1-first.with.custom.name'
SAMPLE2='2-second.with.custom.name'
for (( i = 1; i <= 2; i++ ))
do
echo SAMPLE{$i}
done
I would expect the output:
1-first.with.custom.name
2-second.with.custom.name
but i got:
SAMPLE{1}
SAMPLE{2}
Is it possible generate var names in the fly?