From 4ee346b521d3897ba765d17b8ce2a955e838c504 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Fri, 13 Mar 2020 10:46:54 +0400 Subject: [PATCH] maj chemin ip --- ipaddr | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ipaddr b/ipaddr index 316ff4d..811a16b 100755 --- a/ipaddr +++ b/ipaddr @@ -2,9 +2,14 @@ # -*- 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 +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= -/usr/bin/ip addr "$@" | awk -v isatty="$isatty" ' +"$IP" addr "$@" | awk -v isatty="$isatty" ' isatty && $0 ~ /^[0-9]/ { $0 = gensub(/: ([^:]+):/, ": \x1B[32m\\1\x1B[0m:", 1) }