ip route show | grep 'default' | awk '{print $3}'
#vim getgw.sh
#!/bin/sh
default_gateway_ip=`ip route show | grep 'default' | awk '{print $3}'`
echo $default_gateway_ip
default_gateway_ip=`ip route show | grep 'default' | awk '{print $3}'`
echo $default_gateway_ip