This is based on the answer to:
Doing this applescript command works fine in terminal (it opens a new window and tells me the uptime):
osascript -e 'tell app "Terminal" to do script "uptime"'
However, trying to pass a variable as a string literal does not work:
cmd="'tell app \"Terminal\" to do script \"uptime\"'"
osascript -e ${cmd}
"0:1: syntax error: A unknown token can’t go here. (-2740)"
What's going on?