Getting the current IP from the command line I made a tiny little bash script, that prints the current IP Address to the command line. I checked the script with ShellCheck (0.4.6-1) on a local debian install and I get the following message:


  SC2026: This word is outside of quotes. Did you intend to 'nest '"'single quotes'"' instead'?


What is wrong with the way I have been line-breaking the pipe, or what is proper practice?

#!/bin/bash

 curl -s POST whatismyip.org\
  | grep -A1 'Your IP Address'\
  | awk -F '&gt;' '{print $2}'\
  | sed 's/&lt;\/h2//g'\
  | sed 's/&lt;\/span//g'
I would use a different service that provides output in a format that is good for tools (not humans (html is for displaying for humans)).

Hit this url:

https://ifconfig.co/json


You're output looks like this:

{
  "ip": "154.140.296.288",
  "ip_decimal": 926648668,
  "country": "United States",
  "city": "Seattle",
  "hostname": "154-140-296-288.Bob.com"
}


Which is obviously json which can be parsed using the jq tool.

&gt; curl -s https://ifconfig.co/json  | jq .ip -r
154.140.296.188