title: Bash script: Use string variable in curl JSON Post data
body: <p>I want to send a json request and embedd a variable in the post data.
  I did a little research and I came up with the single quotes around the variable.</p>
  
  <pre><code>    #!/bin/bash
      FILENAME="/media/file.avi"
      curl -i -X POST -H "Content-Type: application/json" —d '{"jsonrpc": "2.0", "method": "Player.Open", "params":{"item":{"file":"'$FILENAME'"}}}' http://192.167.0.13/jsonrpc
  </code></pre>
  
  <p>Unfortunately I get some errors:</p>
  
  <pre><code>curl: (6) Couldn't resolve host '—d'
  curl: (3) [globbing] nested braces not supported at pos 54
  HTTP/1.1 200 OK
  Content-Length: 76
  Content-Type: application/json
  Date: Wed, 29 Jan 2014 19:16:56 GMT
  
  {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}
  </code></pre>
  
  <p>Appearently there are some problems with the braces and the http answer states, that the command could not be executed. What's wrong with my code here? 
  Thanks!</p>
  
  <p>This is my <code>curl</code> version:</p>
  
  <pre><code>curl 7.30.0 (mips-unknown-linux-gnu) libcurl/7.30.0 OpenSSL/0.9.8y
  Protocols: file ftp ftps http https imap imaps pop3 pop3s rtsp smtp smtps tftp 
  Features: IPv6 Largefile NTLM NTLM_WB SSL 
  </code></pre>