title: How to use a variable in a CURL request with bash?
body: <p><strong>Goal:</strong></p>
  
  <p>I'm using a bash CURL script to connect to the Cloudflare APIv4. The goal is to update an A-record. My script:</p>
  
  <pre><code>   # Get current public IP
        current_ip=curl --silent ipecho.net/plain; echo
  
     # Update A record
        curl -X PUT "https://api.cloudflare.com/client/v4/zones/ZONEIDHERE/dns_records/DNSRECORDHERE" \
          -H "X-Auth-Email: EMAILHERE" \
          -H "X-Auth-Key: AUTHKEYHERE" \
          -H "Content-Type: application/json" \
          --data '{"id":"ZONEIDHERE","type":"A","name":"example.com","content":"'"${current_ip}"'","zone_name":"example.com"}'
  </code></pre>
  
  <p><strong>Problem:</strong></p>
  
  <p>The current_ip variable is not printed when I call it in my script. The output will be <code>"content" : ""</code> and not <code>"content" : "1.2.3.4"</code>.</p>
  
  <p>I used <a href="https://stackoverflow.com/questions/17029902/using-curl-post-with-variables-defined-in-bash-script-functions">other</a> stackoverflow posts and I'm trying to follow their examples but I think I'm still doing something wrong, just can't figure out what. :(</p>