I have the following simple bash script that stores the output of a command in a variable and prints it:
size=$(curl -sI "http://speedtest.reliableservers.com/1GBtest.bin" | grep -i "length")
echo "--> ${size} <--"
When running the command in the terminal, I get the following output:
Content-Length: 1073471824
But when I run this bash script that invokes the command, I get the following output:
<--Content-Length: 1073741824
What is going on?
./wtf.shin the Ubuntu terminal. Bothsh wtf.shandbash wtf.shresult in the same thing.2.txthas just a single line, however.grep -i "length.*[0-9]"or usedos2unix.