From 0b3653fe2deafc6482948407d6dd1bc1ade80eb1 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Fri, 29 May 2020 20:53:28 -0500 Subject: [PATCH] Failure detection for curl --- gravity-sync.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gravity-sync.sh b/gravity-sync.sh index 19bd4aa..e4c8769 100755 --- a/gravity-sync.sh +++ b/gravity-sync.sh @@ -890,8 +890,13 @@ function show_version { MESSAGE="Running Version: ${VERSION}" echo_info - GITVERSION=$(curl -s https://raw.githubusercontent.com/vmstan/gravity-sync/master/VERSION) - MESSAGE="Latest Version: ${GITVERSION}" + GITVERSION=$(curl -sf https://raw.githubusercontent.com/vmstan/gravity-sync/master/VERSION) + if [ -z "$GITVERSION" ] + then + MESSAGE="Latest Version: Unable to Check" + else + MESSAGE="Latest Version: ${GITVERSION}" + fi echo_info }