I need to indirectly reference a variable in the bash
shell.
I basically want to what you can do in make
by writing $($(var))
.
I have tried using ${$var}
which would be the most straight forward solution in bash
but then I get this error:
bash: ${$var}: bad substitution
Is there a way to do this?
What I am trying to do is to iterate over all the arguments ($1
, $2
, $3
, ...) to a program using an iteration variable and I cannot do this without indirection.