I'm trying to figure out the proper way to expand a variable within a string and in quotes when I want it done.
Here's some of the code:
LABEL="-run_label \"\$STATUS\""
#some stuff done here
STATUS="We_re running something now..."
POSTFIX="<command_call> other_args $LABEL"
Unfortunately if I do an $(eval echo $POSTFIX)
and save that to a variable the result is something like
<command_call> other_args -run_label We_re running something now...
and it blows up because it doesn't recognize arguments "running", "something", "now..."
So I've tried to set LABEL="-run_label \\\"\$STATUS\\\""
then run $(eval echo $POSTFIX)
but now it's <command_call> other_args -run_label '"We_re' 'running' 'something' 'now..."'
and it again complains that 'running' 'something' 'now...' are not valid arguments.
What am I doing wrong to expand these variables in a string inside a quote block (can be single or double quote) at a later time when I need it to be called?
Edit: I'm not using that exact string so removed the ' as I realized it would complain and moved to _