maj chemin ip
This commit is contained in:
parent
c9796b2562
commit
4ee346b521
7
ipaddr
7
ipaddr
|
@ -2,9 +2,14 @@
|
||||||
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||||||
# frontend pour 'ip addr' qui formatte l'affichage pour prendre moins de place
|
# frontend pour 'ip addr' qui formatte l'affichage pour prendre moins de place
|
||||||
|
|
||||||
|
if [ -x /usr/bin/ip ]; then IP=/usr/bin/ip
|
||||||
|
elif [ -x /bin/ip ]; then IP=/bin/ip
|
||||||
|
else IP=ip
|
||||||
|
fi
|
||||||
|
|
||||||
tty -s <&1 && isatty=1 || isatty=
|
tty -s <&1 && isatty=1 || isatty=
|
||||||
|
|
||||||
/usr/bin/ip addr "$@" | awk -v isatty="$isatty" '
|
"$IP" addr "$@" | awk -v isatty="$isatty" '
|
||||||
isatty && $0 ~ /^[0-9]/ {
|
isatty && $0 ~ /^[0-9]/ {
|
||||||
$0 = gensub(/: ([^:]+):/, ": \x1B[32m\\1\x1B[0m:", 1)
|
$0 = gensub(/: ([^:]+):/, ": \x1B[32m\\1\x1B[0m:", 1)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue