Bash - variable variables

bash, variables

Solution

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

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

# something

Problem

I have the variable `$foo="something"` and would like to use: ``` bar="foo"; echo $($bar) ``` to get "something" echoed.

Original source

Related problems