Does anyone know of a way to force a variable name held in another variable to return the value of the first variable? Best if I give an example, that does not work:
/usr/local/bin >cat mike.sh
NUM1ref=16
NUM2ref=32
echo "=============="
for VAR in NUM1 NUM2
do
XXXX=${VAR}ref
echo $XXXX
echo "=============="
done
/usr/local/bin >./mike.sh
==============
NUM1ref
==============
NUM2ref
==============
/usr/local/bin >
I want this to echo the value held in NUM1ref (16), rather than the string "NUM1ref", so the variable XXXX has to be evaluated twice.
I hope that makes sense!