mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-22 12:20:07 +00:00
pick up ifconfig
and ip
from PATH
Apparently there are systems on which these tools are not in /sbin. Fixes #472.
This commit is contained in:
parent
d716875918
commit
17d3dc78fe
1 changed files with 4 additions and 4 deletions
|
@ -4569,8 +4569,8 @@ function _p9k_prompt_net_iface_compute() {
|
|||
function _p9k_prompt_net_iface_async() {
|
||||
local iface ip line var
|
||||
typeset -a iface2ip
|
||||
if [[ -x /sbin/ifconfig ]]; then
|
||||
for line in ${(f)"$(/sbin/ifconfig 2>/dev/null)"}; do
|
||||
if (( $+commands[ifconfig] )); then
|
||||
for line in ${(f)"$(command ifconfig 2>/dev/null)"}; do
|
||||
if [[ $line == (#b)([^[:space:]]##):[[:space:]]##flags=(<->)'<'* ]]; then
|
||||
[[ $match[2] == *[13579] ]] && iface=$match[1] || iface=
|
||||
elif [[ -n $iface && $line == (#b)[[:space:]]##inet[[:space:]]##([0-9.]##)* ]]; then
|
||||
|
@ -4578,8 +4578,8 @@ function _p9k_prompt_net_iface_async() {
|
|||
iface=
|
||||
fi
|
||||
done
|
||||
elif [[ -x /sbin/ip ]]; then
|
||||
for line in ${(f)"$(/sbin/ip -4 a show 2>/dev/null)"}; do
|
||||
elif (( $+commands[ip] )); then
|
||||
for line in ${(f)"$(command ip -4 a show 2>/dev/null)"}; do
|
||||
if [[ $line == (#b)<->:[[:space:]]##([^:]##):[[:space:]]##\<([^\>]#)\>* ]]; then
|
||||
[[ ,$match[2], == *,UP,* ]] && iface=$match[1] || iface=
|
||||
elif [[ -n $iface && $line == (#b)[[:space:]]##inet[[:space:]]##([0-9.]##)* ]]; then
|
||||
|
|
Loading…
Reference in a new issue