String expansion in bash with embedded quotes
Because $TARG_DB
is within single quotes within the subshell, it's taken literally. Use double quotes there, they won't mess up the subshell. e.g.
$ tmp="a b c"$ echo $tmpa b c$ echo $(echo $tmp)a b c$ echo $(echo "$tmp")a b c$ echo $(echo '$tmp')$tmp$ echo "$(echo '$tmp')"$tmp$ echo "$(echo "$tmp")"a b c