From 3e9975c4386d578c238735ad517c914fdbe2fd5e Mon Sep 17 00:00:00 2001 From: Dylan Date: Tue, 9 Feb 2016 09:36:43 +1100 Subject: [PATCH] Add local IP support to Linux and Windows --- fetch | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/fetch b/fetch index 77ca216e..d4ecc3a7 100755 --- a/fetch +++ b/fetch @@ -1335,6 +1335,26 @@ getbattery () { # }}} +# IP Address {{{ + +getlocalip () { + case "$os" in + "Linux") + localip="$(ip route get 1 | awk '{print $NF;exit}')" + ;; + + "Windows") + localip="$(ipconfig | awk -F ': ' '/IPv4 Address/ {printf $2}')" + ;; + + *) + localip="Unknown" + ;; + esac +} + +# }}} + # Birthday {{{ getbirthday () {