How to perform Variable Expansion (Parameter Expansion) on a string in bash without performing Command Substitution at the same time ?
Example: V=variable C=poweroff S='We have $V and $($C)'
I'm seeking a bash command/script that, when given "$S"
as input, produces
We have variable and $(poweroff)
as output (without powering the machine off).
Edit: This shall work not only with hand-crafted strings but in a generic way with any string, whether it contains variable references or not.