From fea8c9d418bb6c8e8c79f95ba5434e0e9437618d Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Wed, 26 Apr 2017 09:11:21 +0300 Subject: [PATCH] some error processing to whatismyip --- web/whatismyip | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/whatismyip b/web/whatismyip index ec634ad..c4f3a6b 100755 --- a/web/whatismyip +++ b/web/whatismyip @@ -16,8 +16,12 @@ done IP=$( dig +short myip.opendns.com @resolver1.opendns.com ) if [[ "$NAME" -eq 1 ]]; then - dig +short -x "$IP" + output=$( dig +short -x "$IP" ) else - echo $IP + output="$IP" fi +if [[ -z "$output" ]]; then + exit 1 +fi +echo "$output"