Commit e8b121c9 authored by Muhammad Herdiansyah's avatar Muhammad Herdiansyah

Local IP: Merge BSD and Solaris to Linux

parent 93e7ab0b
...@@ -1638,8 +1638,9 @@ get_battery() { ...@@ -1638,8 +1638,9 @@ get_battery() {
get_local_ip() { get_local_ip() {
case "$os" in case "$os" in
"Linux") "Linux" | "BSD" | "Solaris")
local_ip="$(ip route get 1 | awk '{print $NF;exit}')" 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") "Mac OS X" | "iPhone OS")
...@@ -1647,10 +1648,6 @@ get_local_ip() { ...@@ -1647,10 +1648,6 @@ get_local_ip() {
[[ -z "$local_ip" ]] && local_ip="$(ipconfig getifaddr en1)" [[ -z "$local_ip" ]] && local_ip="$(ipconfig getifaddr en1)"
;; ;;
"BSD" | "Solaris")
local_ip="$(ifconfig | awk '/broadcast/ {print $2}')"
;;
"Windows") "Windows")
local_ip="$(ipconfig | awk -F ': ' '/IPv4 Address/ {printf $2 ", "}')" local_ip="$(ipconfig | awk -F ': ' '/IPv4 Address/ {printf $2 ", "}')"
local_ip="${local_ip%\,*}" local_ip="${local_ip%\,*}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment