title: cURL in Bash - Passing Variables Between Single Quotes
body: <p>I am trying to pass parameters to cURL through the command line, this way:</p>
  
  <pre><code>curl -s -X POST -H "Content-Type: text/xml" -H "Cache-Control: no-cache" -d '&lt;Data Token="someToken" Name='"$appName"' ID='"$someVar"' ParseAppID='"$someVar"' ParseRESTKey='"$someVar"' AndroidPackage='"$someVar"' Version="1"&gt;&lt;/Data&gt;' 'https://prefix.something.com/somePath?InputType=Xml'
  </code></pre>
  
  <p>(This line is actually extracted from the Postman app).</p>
  
  <p>I Googled this issue and found whole lot of solutions that did not work for me (links are to SO past questions...):</p>
  
  <ol>
  <li>I tried <a href="https://stackoverflow.com/questions/13799789/expansion-of-variable-inside-single-quotes-in-a-command-in-bash-shell-script">isolating</a> the variables by ending the single quotes, this way: <code>'before...'"${someVar}"'...after...'</code>. Could not complete the request.</li>
  <li>I tried passing the variables <a href="https://stackoverflow.com/questions/4514199/how-to-send-double-quote-in-d-parameter-for-curl-exe">using a file</a> (<code>-d @fileName)</code>. Failed to post.</li>
  <li>I tried <a href="https://stackoverflow.com/questions/13341955/how-to-pass-a-variable-in-a-curl-command-in-shell-scripting">replacing</a> the single quotes surrounding the <code>&lt;Data&gt;</code> tokens  with double quotes - but the command apparently cannot accept such substitution.</li>
  </ol>
  
  <p>The errors I get are either <code>&lt;Error&gt;&lt;/Error&gt;</code> or <code>The server encountered an error and could not complete your request.</code></p>
  
  <p>Is there any chance that there exists some other solution?
  Has anyone encoutered such problem before?</p>
  
  <p>I would be greatful for any help.</p>