New net-tools 'ifconfig' command output has change. So 'ifconfig' is replaced by 'ip a'.

This commit is contained in:
Christoph 2017-05-16 13:53:32 +02:00
parent ddff7f8345
commit ccf7d7a81d
2 changed files with 10 additions and 2 deletions

View File

@ -8,7 +8,11 @@
# - IPv4 Addresses Gateway # - IPv4 Addresses Gateway
# --- # ---
declare -a gateway_ipv4_address_arr 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
# ============= # =============

View File

@ -8,7 +8,11 @@
# - IPv6 Addresses Gateway # - IPv6 Addresses Gateway
# --- # ---
declare -a gateway_ipv6_address_arr 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
# ============= # =============