On 19Jan2022 20:32, ToddAndMargo <ToddAndMargo(a)zoho.com> wrote:
into a variable
X=$(curl -s ipinfo.io -o -)
That is robust (well, it loses trailing whitespace).
But I lose all my line feeds when I
echo -e $X
How do I get my line feeds back?
Quotes.
echo -e "$X"
Unquoted it is broken into "words" on whitespace, and echo prints the
words with a single space between each. With quotes, echo has exactly 1
argument, the string in $X.
Oh, and try to use $lowercase variables for unexported/nonconfiguration
variables.
But add tz says, if it is JSON, better to parse the JSON if you're
picking things out of it.
Cheers,
Cameron Simpson <cs(a)cskk.id.au>