up4=false
- if ! read -r _ _ gateway _ ifdev _ < <(ip -4 route get 85.119.83.50 2>/dev/null); then
- # if our internet is down, just give up, no need to have an error
- if [[ ! $INVOCATION_ID ]]; then
+ if ! tmp=$(ip -4 route get 85.119.83.50 2>/dev/null); then
+ # our internet is down
+ if [[ $INVOCATION_ID ]]; then
+ return 0
+ else
echo $0: failed to get route, giving up
+ exit 0
fi
- exit 0
fi
+ read -r _ _ gateway _ ifdev _ <<<"$tmp"
case $gateway in
10.2.0.1)