title: CURL error "URL using bad/illegal format or missing URL" when trying to pass variable as a part of URL
body: <p>When I'm trying to execute script below and getting error: "curl: (3) URL using bad/illegal format or missing URL"</p>
  
  <pre><code>#!/bin/bash
  
  stage="develop"
  branch="branch_name"
  
  getDefinition=$(curl -u user@example.com:password -X GET "https://dev.azure.com/organization/project/_apis/build/definitions?api-version=5.1")
  
  for def in $(echo "$getDefinition" | jq '.value[] | select (.path=="\\Some_path\\'$stage'") | .id'); do
    getBuildInfo=$(curl -u user@example.com:password -X GET "https://dev.azure.com/organization/project/_apis/build/definitions/${def}\?api-version=5.1")
          # echo $def
          body=$(echo "${getBuildInfo}" | jq '.repository.defaultBranch = "refs/heads/release/'"${branch}"'"' | jq '.options[].inputs.branchFilters = "[\"+refs/heads/release/'"${branch}"'\"]"' | jq '.triggers[].branchFilters[] = "+refs/heads/release/'"${branch}"'"')
          echo ${body} &gt; data.json    
  done
  </code></pre>
  
  <p>It happens when I'm trying to pass variable <strong>${def}</strong> into a line:</p>
  
  <pre><code>curl -u user@example.com:password -X GET "https://dev.azure.com/organization/project/_apis/build/definitions/${def}\?api-version=5.1"
  </code></pre>
  
  <p>But when I declare an array, curl works as expected.
  Example:</p>
  
  <pre><code>declare -a def
  def=(1 2 3 4)
  
  curl -u user@example.com:password -X GET "https://dev.azure.com/organization/project/_apis/build/definitions/${def}\?api-version=5.1"
  </code></pre>
  
  <p>Could you please suggest how can I pass variable into URL properly?</p>