Local IP: Merge BSD and Solaris to Linux
This commit is contained in:
parent
93e7ab0b3a
commit
e8b121c938
7
neofetch
7
neofetch
|
@ -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() {
|
||||||
[[ -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%\,*}"
|
||||||
|
|
Reference in New Issue