aboutsummaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2019-02-06 10:53:46 +0300
committerDominik Ritter <dritter03@googlemail.com>2019-02-06 10:53:46 +0300
commit9f9bc62dc9c934fadd799c6942cc4099228b07be (patch)
treeaa7016c80a2b1db3bf0683ff7e9e8768da4d8b08 /functions
parenta00cb84da48b1f53a67c0ed43c90e6b4f720262f (diff)
Avoid loopback interfaces and parse IPv4 on OSX
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/utilities.zsh5
1 files changed, 4 insertions, 1 deletions
diff --git a/functions/utilities.zsh b/functions/utilities.zsh
index 5532eef6..13a7b82d 100755
--- a/functions/utilities.zsh
+++ b/functions/utilities.zsh
@@ -401,8 +401,11 @@ function p9k::parseIp() {
local newline=$'\n'
for interfaceName in $relevantInterfaces; do
local interface="$(${ROOT_PREFIX}/sbin/ifconfig $interfaceName 2>/dev/null)"
+ if [[ "${interface}" =~ "lo[0-9]*" ]]; then
+ continue
+ fi
# Check if interface is UP.
- if [[ "${interface/${newline}/}" =~ "<UP(,)?[^>]*>(.*)inet[ ]*([^ ]*)" ]]; then
+ if [[ "${interface/${newline}/}" =~ "<UP(,)?[^>]*>(.*)inet[ ]+([^ ]*)" ]]; then
echo "${match[3]}"
return 0
fi