From d0ab6174f37e6c8c4cd1c49fe4eb97d87615c882 Mon Sep 17 00:00:00 2001 From: Jay Moore Date: Wed, 12 Apr 2023 16:12:16 +0000 Subject: [PATCH] Use shorter ifconfig command --- getv4.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getv4.sh b/getv4.sh index 8145c0d..af2c915 100644 --- a/getv4.sh +++ b/getv4.sh @@ -11,5 +11,5 @@ dev=em0 -ifconfig $dev | grep inet | awk -F '[ \t]+|/' '{print $3}' | grep -v ^fe80 +ifconfig $dev | awk '/inet/ && !/inet6/ {print $2}' #ip -4 addr show dev $dev | awk '/inet/ {print $2}' # for machines using `ip`