From: Joachim Bauch Date: Tue, 16 Feb 2016 16:56:43 +0000 (+0100) Subject: Handle case where no files to cleanup exists. X-Git-Tag: v0.1.0~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F141%2Fhead;p=thirdparty%2Fdehydrated.git Handle case where no files to cleanup exists. This fixes cases where "*.foo" expands to the string "*.foo" if no matching files exist. --- diff --git a/letsencrypt.sh b/letsencrypt.sh index dc16464..040d622 100755 --- a/letsencrypt.sh +++ b/letsencrypt.sh @@ -701,6 +701,9 @@ command_cleanup() { # Loop over all files of this type for file in "${certdir}/${filebase}-"*".${fileext}"; do + # Handle case where no files match the wildcard + [[ -f "${file}" ]] || break + # Check if current file is in use, if unused move to archive directory filename="$(basename "${file}")" if [[ ! "${filename}" = "${current}" ]]; then