foo=username
bar=foo
a=$(eval echo \$$bar) # same as ${!bar}
echo $(eval echo \$${a^^}) # expected val
How to get the value of foo through the variable bar, Same as the above output
I know it wants a variable name not a string here.
echo $(eval echo \$${${!bar}^^}) # error bad substitution