ipaddr: forcer la sortie couleur

This commit is contained in:
Jephté Clain 2022-08-13 18:57:19 +04:00
parent af1bdd3ca5
commit f4047a3b64
1 changed files with 3 additions and 1 deletions

4
ipaddr
View File

@ -7,7 +7,9 @@ elif [ -x /bin/ip ]; then IP=/bin/ip
else IP=ip else IP=ip
fi fi
tty -s <&1 && isatty=1 || isatty= if [ -n "IPADDR_COLOR" ]; then isatty=1
else tty -s <&1 && isatty=1 || isatty=
fi
"$IP" addr "$@" | awk -v isatty="$isatty" ' "$IP" addr "$@" | awk -v isatty="$isatty" '
isatty && $0 ~ /^[0-9]/ { isatty && $0 ~ /^[0-9]/ {