From 9b831166f88203f0f4203c565a55327486a4997f Mon Sep 17 00:00:00 2001 From: Stephen Date: Fri, 27 Nov 2020 14:27:11 -0800 Subject: [PATCH] fix linux ip --- functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions b/functions index 3475054..d0a6648 100644 --- a/functions +++ b/functions @@ -5,7 +5,7 @@ function shownetinfo() { NET="" if [ "$OSTYPE" = "Linux" ]; then - IP=$(ip address show | grep -E "inet .* brd .* dynamic" | cut -d " " -f6) + IP=$(ifconfig | grep -v "127.0.0.1" | grep "inet " | head -1 | cut -d " " -f10) GW=$(ip route | grep default | cut -d " " -f3) elif [ "$OSTYPE" = "Darwin" ]; then NET=$(system_profiler SPNetworkDataType | grep "Router:" | cut -c 19-30 | head -1)