From 1f499de4ce698778859a328b006fb16bac4259ca Mon Sep 17 00:00:00 2001 From: Gardouille Date: Tue, 8 Sep 2015 00:41:17 +0200 Subject: [PATCH] Use /sys to get the list of network interface. --- zshrc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zshrc b/zshrc index 8e8e9c3..ae956a3 100644 --- a/zshrc +++ b/zshrc @@ -344,8 +344,11 @@ function ippub() #Récupère l'adresse IP (privee) function ippriv() { - printf 'eth0: %s\n' $(ip a s eth0|grep "inet "|awk '{print $2}') - printf 'wlan0: %s\n' $(ip a s wlan0|grep "inet "|awk '{print $2}') + for interface in $(find /sys/class/net/ ! -name lo -type l -printf "%f\n" | sort); + do + IP_INTER=$(ip a s ${interface}|grep "inet "|awk '{print $2}') + printf '%b' "${WHITEB}${interface}${RESET}: ${IP_INTER}\n" + done }