From 2276c3c8aeec9a4a7ae288a3ee99a4123198575d Mon Sep 17 00:00:00 2001 From: Manuel Date: Wed, 27 Dec 2017 10:18:29 +0100 Subject: [PATCH] Fixed comparison arithmetic context and comparison order --- NextcloudBackup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NextcloudBackup.sh b/NextcloudBackup.sh index 38de995..dae6e7f 100644 --- a/NextcloudBackup.sh +++ b/NextcloudBackup.sh @@ -126,11 +126,11 @@ echo # # Delete old backups # -if [ ${maxNrOfBackups} != 0 ] +if (( ${maxNrOfBackups} != 0 )) then nrOfBackups=$(ls -l ${backupMainDir} | grep -c ^d) - if [ ${maxNrOfBackups} > ${nrOfBackups} ] + if (( ${nrOfBackups} > ${maxNrOfBackups} )) then echo "Removing old backups..." ls -t ${backupMainDir} | tail -$(( nrOfBackups - maxNrOfBackups )) | while read dirToRemove; do -- 2.34.1