Capture gateway IP using shell script

From Notes_Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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 }')