Capture gateway IP using shell script

From Notes_Wiki

Home > Shell scripting > Useful bash shell scripts > Capture gateway IP using shell script

To capture gateway IP using shell-script use:

IP=$(/sbin/ip route | awk '/default/ { print $3 }')