From 011d39ae23515ed1585053c68b9eefd629d97ae9 Mon Sep 17 00:00:00 2001 From: David Mcanulty Date: Tue, 3 May 2016 11:10:04 -0700 Subject: [PATCH] Move test to bottom and switched from $? to $ret I could refactor the if/else logic to provide curl|wget in the debug message, but wanted to keep the change simple to hopefully get pulled. --- acme.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/acme.sh b/acme.sh index c53c6fa0..469fffa8 100755 --- a/acme.sh +++ b/acme.sh @@ -520,14 +520,8 @@ _get() { if _exists "curl" ; then if [ "$onlyheader" ] ; then $CURL -I -A "User-Agent: $USER_AGENT" $url - if [ $? -gt 0 ] ;then - _err "Curl failed with exit code $?, trying running script with --debug 2" - fi else $CURL -A "User-Agent: $USER_AGENT" $url - if [ $? -gt 0 ] ;then - _err "Curl failed with exit code $?, trying running script with --debug 2" - fi fi else _debug "WGET" "$WGET" @@ -538,6 +532,9 @@ _get() { fi fi ret=$? + if [ $ret -gt 0 ] ;then + _err "URL get failed with exit code $ret, trying running script with --debug 2" + fi return $ret }