From 675adaefcaabfcc67406d21191f2b26ccc8f7cb1 Mon Sep 17 00:00:00 2001 From: Stephen Date: Sun, 24 May 2020 13:45:24 -0700 Subject: [PATCH] fix up exec order --- functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/functions b/functions index d8fbc8d..1b17cf0 100644 --- a/functions +++ b/functions @@ -2,12 +2,13 @@ function shownetinfo() { OSTYPE=$(uname -s) IP="" GW="" - NET=$(system_profiler SPNetworkDataType | grep "Router:" | cut -c 19-30 | head -1) + NET="" if [ "$OSTYPE" = "Linux" ]; then IP=$(ip address show | grep -E "inet .* brd .* dynamic" | cut -d " " -f6) GW=$(ip route | grep default | cut -d " " -f3) elif [ "$OSTYPE" = "Darwin" ]; then + NET=$(system_profiler SPNetworkDataType | grep "Router:" | cut -c 19-30 | head -1) IP=$(ifconfig en0 | grep -v "127.0.0.1" | grep "inet " | head -1 | cut -d " " -f2) if [ "$NET" != "" ]; then GW=$(dig +short myip.opendns.com @resolver1.opendns.com)