Problem:
The following shell script code does not produce the expected result:
# MYSQL, MyUSER MyHost etc ... all defined above as normal
TARG_DB="zztest";
DB_CREATE="$($MYSQL -u $MyUSER -h $MyHOST -p$MyPASS -Bse 'create database $TARG_DB')";
Expected outcome:
A new database created with the name zztest
Actual outcome:
A new database created with the name $TARG_DB
Question:
How can this example code be changed such that $TARG_DB
is interpolated or expanded, giving the expected outcome?