Bash variable indirection

This is not how to get, in bash, the value of a variable whose name is in another variable:

$ A=1
$ B=A
$ echo ${$B}
bash: ${$B}: bad substitution

This is how:

$ echo ${!B}

It however only works in bash. For more portable scripts, eval is needed:

$ eval echo \$$B

Thanks to Martin Krafft and Cyril Brulebois.