Bash – variable variables [duplicate]

In bash, you can use ${!variable} to use variable variables.

foo="something"
bar="foo"
echo "${!bar}"

# something

Leave a Comment