I started writing ipaddr almost 20 years ago after the umpteenth
time trying to parse ifconfig (and later ip) output in scripts. The
original version was get only and Linux only.
It now supports Linux, QNX, and most BSDs. However, I rarely use BSD
these days... so the set functions may not work 10
This is the output on my machine:
10.0.1.176 (enp0s25)
10.0.1.176 (enp0s25)
10.0.0.3 (wg0)
Notice the duplicate addresses for enp0s25.
As I'm sure you know, as per the IP spec, a NIC can have multiple addresses,
so long as they're on different subnets.
Output of `ip -br address show enp0s25`:
enp
On Sun, 26 Mar 2023 10:54:19 -0700
Jeremy wrote:
> One alternative is to just get the address from ifaddrs->ifa_addr.
That is what I did.
# /tmp/ipaddr
192.168.1.115 (genet0)
192.168.2.2 (genet0)
However, I am not sure what to do if you ask for the ip of the
interface:
# /tmp/ipaddr genet0
19