Use /sys to get the list of network interface.

This commit is contained in:
gardouille 2015-09-08 00:41:17 +02:00
parent 70392b1e4e
commit 1f499de4ce
1 changed files with 5 additions and 2 deletions

7
zshrc
View File

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