eval

Compose a statement for execution.

1x='echo $y'
2echo $x
3y=dragon
4eval "$x"

The results remain in the current shell, unlike sub-shells.

1b=basilisk
2sh -c 'echo $b'
3eval "g=goblin"
4echo $g