From e1bdaa6bfe92ef09e15c94637c07ff3768dff2bc Mon Sep 17 00:00:00 2001 From: Mattia Basaglia Date: Sat, 21 May 2016 18:38:03 +0200 Subject: [PATCH] IP interface variable and split IPv6 --- systempony | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/systempony b/systempony index cc116de..7f47efe 100755 --- a/systempony +++ b/systempony @@ -7,6 +7,8 @@ PONY=random INFO=(User Hostname IP Distro Kernel Uptime Load Shell Packages RAM Swap Disk) # File system type to show disk usage (default/empty=all) (see df for specific values) FSTYPE= +# Interface to get the IP address from +IP_INTERFACE="eth0" function ponyget_Shell() { @@ -137,7 +139,13 @@ function ponyget_Containers() function ponyget_IP() { - ip -o addr | grep -vE "lo\s+inet" | grep -Po "inet6?\s*\K[^/]+" | xargs echo + [ -z "$1" ] && inet="inet" || inet="$1" + ip -o addr | grep -vE "lo\s+inet" | grep -F "$IP_INTERFACE" | grep -Po "$inet\s+\K[^/]+" | xargs echo +} + +function ponyget_IPv6() +{ + ponyget_IP inet6 } function bold()