From ac2d8303f1f740f437e721b700b5044886557b30 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 16 Feb 2016 17:56:43 +0100 Subject: [PATCH] Handle case where no files to cleanup exists. This fixes cases where "*.foo" expands to the string "*.foo" if no matching files exist. --- letsencrypt.sh | 3 +++ 1 file changed, 3 insertions(+) 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 -- 2.39.5