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}doneI would expect the output:1-first.with.custom.name2-second.with.custom.namebut i got:SAMPLE{1}SAMPLE{2}Is it possible generate var names in the fly?
How to generate new var names on the fly
bash;shell script;variable substitution
Why not use an array, they're meant for doing things like that.sample[1]='1-first.with.custom.name'sample[2]='2-second.with.custom.name'for (( i = 1; i <= 2; i++ ))do  echo ${sample[$i]}doneAlso don't use all-capital variable names in your script to prevent accidentally using reserved variable names.