Use `${!varname}` where `varname=foo` to get `$foo`.
Use
${!varname}wherevarname=footo get$foo.