Suppose I have a bash variable like this:
tmp1='$(echo foo)'
or
tmp2='`echo foo`'
How to achieve foo as result?
I know that removing the command substitution from the string should work, but is there any other way despite this?
Suppose I have a bash variable like this:
tmp1='$(echo foo)'
or
tmp2='`echo foo`'
How to achieve foo as result?
I know that removing the command substitution from the string should work, but is there any other way despite this?
The answer is "don't do this". This is simply not a thing that Bash is designed to do: