I have a bash variable as such
HAP="$(echo ${d} | cut -f 7 -d '/' | sed 's/[A-Z,0-9]\+//' | sed 's/_//')"
that when is run as part of a script return either ref or hap. Now, I have another part of the same script where I'm running a step in a for loop which needs to be split into hap1 and hap2, respectively. So, ideally I will need something similar to the following:
for hap in [1:2]; do printf "%s\n" $HAP${hap}; done
that would return the value of $HAP twice appending to it the step of the iterator I'm at, resulting in something like:
hap1
hap2
However, the former loop gives this:
hap[1:2]
It is the first time I'm attempting this, and I'm not sure what is wrong... thanks in advance!