From: Simon Ruderich Date: Sat, 5 Dec 2015 13:25:11 +0000 (+0100) Subject: use [ -z .. ] instead of explicit compare with "" X-Git-Tag: v0.1.0~221^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f3ee624c548de95c0c3a2eb5aa1e154d2f09856;p=thirdparty%2Fdehydrated.git use [ -z .. ] instead of explicit compare with "" --- diff --git a/letsencrypt.sh b/letsencrypt.sh index eb72b3d..361ab30 100755 --- a/letsencrypt.sh +++ b/letsencrypt.sh @@ -55,7 +55,7 @@ sign_domain() { challenge_token="$(printf '%s\n' "${response}" | grep -Eo '"challenges":[^\[]*\[[^]]*]' | sed 's/{/\n{/g' | grep 'http-01' | grep -Eo '"token":\s*"[^"]*"' | cut -d'"' -f4 | sed 's/[^A-Za-z0-9_\-]/_/g')" challenge_uri="$(printf '%s\n' "${response}" | grep -Eo '"challenges":[^\[]*\[[^]]*]' | sed 's/{/\n{/g' | grep 'http-01' | grep -Eo '"uri":\s*"[^"]*"' | cut -d'"' -f4)" - if [ "${challenge_token}" = "" ] || [ "${challenge_uri}" = "" ]; then + if [ -z "${challenge_token}" ] || [ -z "${challenge_uri}" ]; then echo " + Error: Can't retrieve challenges (${response})" exit 1 fi