Haven't tried it with Calibre, but this is generally a good technique:
http://www.cyberciti.biz/tips/handli...s-in-bash.html
You could also try echoing the variables to sed and substitut the spaces with '\ ', or whichever slash is needed to escape it on the cli.