Skip to content

Commit

Permalink
[PR] dylanaraps/neofetch#2362 from CarterLi - LocalIP (macOS): improv…
Browse files Browse the repository at this point in the history
…e detection

Upstream PR: dylanaraps/neofetch#2362
Thanks to @CarterLi

Co-authored-by: 李通洲 <zhangsongcui3371@sina.com>
  • Loading branch information
hykilpikonna and CarterLi committed Aug 15, 2023
2 parents 75750f1 + b313d39 commit 5c785f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions neofetch
Original file line number Diff line number Diff line change
Expand Up @@ -4935,10 +4935,10 @@ get_local_ip() {
"Mac OS X" | "macOS" | "iPhone OS")
if [[ "${local_ip_interface[0]}" == "auto" ]]; then
interface="$(route -n get 1 | awk -F': ' '/interface/ {printf $2; exit}')"
local_ip="$(ipconfig getifaddr "$interface")"
local_ip="$(ifconfig "$interface" | grep "inet " | awk '{print $2}')"
else
for interface in "${local_ip_interface[@]}"; do
local_ip="$(ipconfig getifaddr "$interface")"
local_ip="$(ifconfig "$interface" | grep "inet " | awk '{print $2}')"
if [[ -n "$local_ip" ]]; then
prin "$interface" "$local_ip"
else
Expand Down

0 comments on commit 5c785f0

Please sign in to comment.