mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-12 08:10:07 +00:00
Avoid loopback interfaces and parse IPv4 on OSX
This commit is contained in:
parent
a00cb84da4
commit
9f9bc62dc9
1 changed files with 4 additions and 1 deletions
|
@ -401,8 +401,11 @@ function p9k::parseIp() {
|
||||||
local newline=$'\n'
|
local newline=$'\n'
|
||||||
for interfaceName in $relevantInterfaces; do
|
for interfaceName in $relevantInterfaces; do
|
||||||
local interface="$(${ROOT_PREFIX}/sbin/ifconfig $interfaceName 2>/dev/null)"
|
local interface="$(${ROOT_PREFIX}/sbin/ifconfig $interfaceName 2>/dev/null)"
|
||||||
|
if [[ "${interface}" =~ "lo[0-9]*" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
# Check if interface is UP.
|
# Check if interface is UP.
|
||||||
if [[ "${interface/${newline}/}" =~ "<UP(,)?[^>]*>(.*)inet[ ]*([^ ]*)" ]]; then
|
if [[ "${interface/${newline}/}" =~ "<UP(,)?[^>]*>(.*)inet[ ]+([^ ]*)" ]]; then
|
||||||
echo "${match[3]}"
|
echo "${match[3]}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue