Reputation: 3
I am trying to retrieve the contents of a .html file into a variable using the following:
data=$(curl --silent "$url");
If I echo $data I get the follwing:
</html>of_Hg_sensor_2 -23.29362<br/>eta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></meta></head>
It appears that it's never starting a new line and simply keeps dumping each successive line over the last.
If I run the same 'curl --silent "$url"' in a shell or redirect output to a file everything looks fine. I've tried running in sh and bash.
I know I could simply retrieve the file but I'd like to avoid a file writes as this will be a heavily repeated process.
I've got to be missing something simple/stupid?
Upvotes: 0
Views: 2090
Reputation: 108
echo "$data"
Without the double quotes, the newlines are converted to spaces.
Upvotes: 1