Please see BashFAQ/050.
This fails because of WordSplitting and because the single quotes inside the variable are literal; not syntactical.
You should avoid putting commands in variables when shell scripting.
Use a function to be able to reuse a command. Use set -x
for logging. Or use an array to hold the individual parts of the command and its arguments only if you must.
By the way, in one line you use $()
for command substitution. This is the correct way. In another line you use backticks which is deprecated. At least be consistent.