From fd0492a1d1569c018fbecb425e304e647e0c5409 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Wed, 2 Aug 2023 17:24:42 -0500 Subject: [PATCH] new: Add more interface names --- getip.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getip.sh b/getip.sh index 0916cd9..b1174a9 100644 --- a/getip.sh +++ b/getip.sh @@ -3,7 +3,7 @@ # This is a simple script to get the ip addresses of a machine. echo 'ipv4:' -for i in eno1 wlan0; do +for i in eth0 eno1 wlan0; do $(ip -4 addr | grep -q $i) || continue addr="$(ip -4 addr show dev $i | grep -oP '(?<=inet\s)\d+(\.\d+){3}')" [ -z "$addr" ] || echo -e "\t$i: \t\t$addr" @@ -14,7 +14,7 @@ echo -e "\texternal: \t${addr:-n/a}" [ "$(cat /sys/module/ipv6/parameters/disable)" == "1" ] && exit echo 'ipv6:' -for i in eno1 wlan0; do +for i in eth0 eno1 wlan0; do $(ip -6 addr | grep -q $i) || continue addr="$(ip -6 addr show dev $i | grep -oP '(?<=inet6\s)\w+(\:{1,2}\w+){4}(?=.+link)')" [ -z "$addr" ] || echo -e "\t$i: \t\t$addr"