title: How I get the HTTP responses from bash script with curl command?
body: <p>I have the following command that I execute from the shell:</p>
  
  <pre><code>curl -v -s -X GET -H "UserName: myUsername" -H "Password: myPassword" 
  https://example.com
  </code></pre>
  
  <p>and from terminal I have the HTTP/1.1 200 response with different response parameters:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Date: Fri, 23 Oct 2015 10:04:02 GMT
  Name: myName
  Age: myAge
  
  ...
  </code></pre>
  
  <p>Now, in my .sh file i want take name and age so have the values in my variables $name and $age.
  My initial idea was to redirect stdout to a file to parse:</p>
  
  <pre><code>curl -v -s -X GET -H "UserName: myUsername" -H "Password: myPassword"
  https://example.com &gt; out.txt
  </code></pre>
  
  <p>but the file is empty.</p>
  
  <p>Some ideas to have a variables in bash script enhanced by the HTTP response?</p>
  
  <p><strong>EDIT: the variables that I want to take are in the header of the response</strong></p>
  
  <p>Thanks</p>