Skip to content

Commit

Permalink
Updated comments for interface detection
Browse files Browse the repository at this point in the history
  • Loading branch information
emielkuiper committed Apr 12, 2019
1 parent a0c836f commit ca2a5f5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ export OSTYPE=`uname`

# Check commands based on OSTYPE
if [[ "$OSTYPE" =~ "Darwin" ]]; then
echo ""
echo "OS type determined as $OSTYPE"
export LOCAL_IF=`netstat -rn | grep ^default | grep -v tun | awk '{print $NF}' | sort | head -n1`
export LOCAL_IP=`ifconfig $LOCAL_IF | grep inet\ | awk '{print $2}'`
echo "Working with interface: $LOCAL_IF"
echo "Working with IP address: $LOCAL_IP"
echo ""
elif [[ "$OSTYPE" =~ "Linux" ]]; then
echo "OS type determined as $OSTYPE"
export LOCAL_IF=`ip route | grep default | cut -d' ' -f5`
export LOCAL_IP=`ip -f inet addr show dev $LOCAL_IF | grep inet | awk '{print $2}' | cut -d'/' -f1`
echo "Working with interface: $LOCAL_IF"
echo "Working with IP address: $LOCAL_IP"
echo ""
fi


Expand Down

0 comments on commit ca2a5f5

Please sign in to comment.