I am having a strange issue with storing the output of a curl into a bash variable.
If I run the following curl
curl -i -s https://google.com
I get the following output:
HTTP/2 301
location: https://www.google.com/
content-type: text/html; charset=UTF-8
date: Sat, 22 Dec 2018 03:03:59 GMT
expires: Mon, 21 Jan 2019 03:03:59 GMT
cache-control: public, max-age=2592000
server: gws
content-length: 220
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
alt-svc: quic=":443"; ma=2592000; v="44,43,39,35"
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
Now if I try and store the same query into a bash variable
GOOGLE=$(curl -s -i https://google.com)
echo $GOOGLE
I get the following output:
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>301 Moved</TITLE></HEAD><BODY> <H1>301 Moved</H1> The document has moved <A HREF= </BODY></HTML>ogle.com/">here</A>.
This is correct but the first half of the curl output is missing... does anybody know where the rest of the output has gone?