From 04affe379943dc18a73e805fed5c318daf7cce01 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Fri, 11 Mar 2011 17:43:14 +0100 Subject: [PATCH] Now tests for the presence of the gw ip in checkgw. --- bashrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index dbe21a4..3c4123e 100644 --- a/bashrc +++ b/bashrc @@ -344,7 +344,13 @@ function netdown () { } function checkgw () { - ping $(route -n | grep ^0.0.0.0 | awk '{print $2}') + GW=$(route -n | grep ^0.0.0.0 | awk '{print $2}') + if [[ -n "${GW}" ]]; then + ping ${GW} + else + echo "Can not find a getaway." >&2 + return 1 + fi } ###################################################################### -- 2.20.1