diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2019-02-21 20:32:17 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2019-02-21 20:37:35 +0300 |
commit | 1ab6a32c4b4871e4161cd75e485c203d0c2111e7 (patch) | |
tree | 1ba3952f8d5f3cff33d86208f831b4fb188b4bae /functions | |
parent | 9f9bc62dc9c934fadd799c6942cc4099228b07be (diff) |
Interface States can be unsorted
Diffstat (limited to 'functions')
-rwxr-xr-x | functions/utilities.zsh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/functions/utilities.zsh b/functions/utilities.zsh index 13a7b82d..069fb1a8 100755 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -405,9 +405,13 @@ function p9k::parseIp() { continue fi # Check if interface is UP. - if [[ "${interface/${newline}/}" =~ "<UP(,)?[^>]*>(.*)inet[ ]+([^ ]*)" ]]; then - echo "${match[3]}" - return 0 + if [[ "${interface/${newline}/}" =~ "<([^>]*)>(.*?)inet[ ]+([^ ]*)" ]]; then + local ipFound="${match[3]}" + local -a interfaceStates=(${(s:,:)match[1]}) + if [[ "${interfaceStates[(r)UP]}" == "UP" ]]; then + echo "${ipFound}" + return 0 + fi fi done else |