title: unexpected EOF while looking for matching `"'
body: <p>The command works fine when I execute from command line. However It throws an error when I execute it from shell script</p>
  
  <pre><code>rsync -avz -e ssh --exclude-from=rsync.file --rsync-path="sudo rsync" ostnfe/ ubuntu@mask.compute-1.amazonaws.com:/var/www/ostnfe
  </code></pre>
  
  <p>Code from shell script:</p>
  
  <pre><code>CMD='rsync -avz -e ssh --exclude-from=rsync.file --rsync-path="sudo rsync"  '$1'/ ubuntu@'$AMZ':/var/www/'$2
  $CMD
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>bash: -c: line 0: unexpected EOF while looking for matching `"'
  bash: -c: line 1: syntax error: unexpected end of file
  </code></pre>