Local IP: Merge BSD and Solaris to Linux

This commit is contained in:
Muhammad Herdiansyah 2016-12-17 15:30:03 +07:00
parent 93e7ab0b3a
commit e8b121c938
1 changed files with 2 additions and 5 deletions

View File

@ -1638,8 +1638,9 @@ get_battery() {
get_local_ip() {
case "$os" in
"Linux")
"Linux" | "BSD" | "Solaris")
local_ip="$(ip route get 1 | awk '{print $NF;exit}')"
[[ -z "$local_ip" ]] && local_ip="$(ifconfig | awk '/broadcast/ {print $2}')"
;;
"Mac OS X" | "iPhone OS")
@ -1647,10 +1648,6 @@ get_local_ip() {
[[ -z "$local_ip" ]] && local_ip="$(ipconfig getifaddr en1)"
;;
"BSD" | "Solaris")
local_ip="$(ifconfig | awk '/broadcast/ {print $2}')"
;;
"Windows")
local_ip="$(ipconfig | awk -F ': ' '/IPv4 Address/ {printf $2 ", "}')"
local_ip="${local_ip%\,*}"