New net-tools 'ifconfig' command output has change. So 'ifconfig' is replaced by 'ip a'.
This commit is contained in:
parent
ddff7f8345
commit
ccf7d7a81d
@ -8,7 +8,11 @@
|
||||
# - IPv4 Addresses Gateway
|
||||
# ---
|
||||
declare -a gateway_ipv4_address_arr
|
||||
read -a gateway_ipv4_address_arr <<<$(ifconfig | grep "inet Ad" | awk '{print$2}' | cut -d':' -f2)
|
||||
|
||||
_ips="$(ip a | grep "inet " | awk '{print$2}' | cut -d'/' -f1)"
|
||||
for _ip in $_ips ; do
|
||||
gateway_ipv4_address_arr+=("$_ip")
|
||||
done
|
||||
|
||||
|
||||
# =============
|
||||
|
@ -8,7 +8,11 @@
|
||||
# - IPv6 Addresses Gateway
|
||||
# ---
|
||||
declare -a gateway_ipv6_address_arr
|
||||
read -a gateway_ipv6_address_arr <<<$(ifconfig | grep "inet6-Ad" | awk '{print$2}'| cut -d'/' -f1)
|
||||
|
||||
_ips="$(ip a | grep "inet6 " | awk '{print$2}' | cut -d'/' -f1)"
|
||||
for _ip in $_ips ; do
|
||||
gateway_ipv6_address_arr+=("$_ip")
|
||||
done
|
||||
|
||||
|
||||
# =============
|
||||
|
Loading…
Reference in New Issue
Block a user