1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-25 20:58:37 -06:00

new: Add more interface names

This commit is contained in:
Sayantan Santra 2023-08-02 17:24:42 -05:00
parent 9c7dcdbd63
commit fd0492a1d1
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F

View file

@ -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"