The simple answer here is that you don't do it that way
. Variables are for storing data
, not code.
I'm trying to put a command in a variable, but the complex cases always fail!
Once a string is stored in a variable, the parsing rules for it are very different, and you just can't reliably run a complex command that way. If you want to set up a dynamic command of some kind, use a function
echo "The command is: mount $@"
CMD /dev/sdb /mnt/disk0