From e8b121c93815c9054fd5e1d0e517261cae45a105 Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sat, 17 Dec 2016 15:30:03 +0700 Subject: [PATCH] Local IP: Merge BSD and Solaris to Linux --- neofetch | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index c48ac298..b0ffd4e5 100755 --- a/neofetch +++ b/neofetch @@ -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%\,*}"