Local IP: Fixed UID showing instead of IP

This commit is contained in:
Muhammad Herdiansyah 2017-02-28 11:58:07 +07:00
parent 716e50ecbf
commit 39986f2197
1 changed files with 2 additions and 1 deletions

View File

@ -1859,7 +1859,8 @@ get_battery() {
get_local_ip() {
case "$os" in
"Linux" | "BSD" | "Solaris" | "AIX")
local_ip="$(ip route get 1 | awk '{print $NF;exit}')"
local_ip="$(ip route get 1 | awk -F'src' '{print $2; exit}')"
local_ip="${local_ip/uid*}"
[[ -z "$local_ip" ]] && local_ip="$(ifconfig -a | awk '/broadcast/ {print $2; exit}')"
;;