title: curl return HTTP code 503 when called from a script
body: <p>I'm try to call some REST API and get the resulting HTTP code using <code>curl</code>. If in a terminal I type : </p>
  
  <pre><code>curl -s -o /dev/null -I -w '%{http_code}' -X POST 'http://localhost/gitlab/api/v3/projects?private_token=my_private_token&amp;name=blabla' -H 'Content-Length: 0'
  </code></pre>
  
  <p>It works and return me the HTTP code <code>201</code> ("created"). Now I try to use this command in a bash script replacing a part of the url with variable: </p>
  
  <pre><code>echo "Enter base URL :"
  read gitlab_url # Here I type 'http://localhost/gitlab', to generate the same URL as in first code snippet
  code_status=$(curl -s -o /dev/null -I -w '%{http_code}' -X POST '$gitlab_url/api/v3/projects?private_token=my_private_token&amp;name=blabla' -H 'Content-Length: 0')
  echo "$code_status"
  </code></pre>
  
  <p>And then it returns me the HTTP code <code>503</code> ("Service Unavailable"). To see if there is any differences between the "hard coded" URL and the generated one, I do :</p>
  
  <pre><code>echo "curl -s -o /dev/null -I -w '%{http_code}' -X POST '$gitlab_url/api/v3/projects?private_token=my_private_token&amp;name=blabla' -H 'Content-Length: 0'"
  # Output :
  curl -s -o /dev/null -I -w '%{http_code}' -X POST 'http://localhost/gitlab/api/v3/projects?private_token=my_private_token&amp;name=blabla' 'Content-Length: 0'
  </code></pre>
  
  <p>And if I execute this in a terminal directly, it works and return me <code>201</code>. So: why do this command fails if I use it in a script ? Is there anything I missed ?</p>