Web lists-archives.com

Re: get my ip address

On 16/02/2019 08.54, David Wright wrote:
On Fri 15 Feb 2019 at 22:04:42 (+0000), Darac Marjal wrote:
If you're going to recommend parsing `ip`, the -j option may be more
amenable to scripting. (JSON output)

On 15/02/2019 15:52, David Wright wrote:
On Fri 15 Feb 2019 at 12:02:20 (+0100), Markus Schönhaber wrote:
Tony, 15.2.2019, 11:11:29 +0100:

Debian 9. I need to read my IPv6 address into a python script.
Some of us here are still running stable (stretch) and older. So
perhaps only for buster onwards and, I assume, stretch-backports.
But …

[That's probably best if your destination is a Python program. ←snipped]

Otherwise, for scripting, it's easy to overlook   ip -o a
which makes parsing much easier.

(Sorry if I was expected to explicitly write "shell scripting".)
… I don't think that JSON would be any help: rather, the opposite.

Though a call to jq makes parsing json very easy for shell scripts.