-5

Display the IP addresses of all currently configured interfaces. The output should done in the following format:i

The interface eth0 currently has the IP 192.168.178.22 The interface eth1 currently has the IP 192.168.178.23 ...etc.

3
  • 3
    Sounds like a (homework) exercise meant to be done by looping over the output of (something like) ip a s. May 6 at 6:29
  • 3
    OP didn't even say Linux was used...
    – A.B
    May 6 at 7:18
  • It is not clear what Unix you are using.
    – Kusalananda
    May 8 at 8:25

2 Answers 2

1

if we are talking about Linux, this one-liner in bash maybe helps you:

ip -br -4 address | awk '{ print $1 " interface has the ip address " $3}'
-2

Make yourself familiar with the concept of pipes.

Then use the commands ip, and some bash builtins like read and while to filter and enhance the output.

See man bash.

1