Add local IP support to Linux and Windows

This commit is contained in:
Dylan 2016-02-09 09:36:43 +11:00
parent 73d50eb6b8
commit 3e9975c438
1 changed files with 20 additions and 0 deletions

20
fetch
View File

@ -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 () {