Given I have the following env variables declared:
MY_VARIABLE_HERE=myValue
SECOND_VARIABLE=secondValue
How can I retrieve these variable within a single quote, wrapped in double quote. i.e. the following
echo '<tag><action name="$MY_VARIABLE_HERE" value="$SECOND_VARIABLE"/></tag>' > my_text.txt
So the expected output for the my_text.txt
would be
<tag>
<action name="myValue" value="secondValue" />
</tag>
>Solution :
echo '<tag><action name="'${MY_VARIABLE_HERE}'" value="'${SECOND_VARIABLE}'"/></tag>' > my_text.txt