From: Manuel Date: Wed, 27 Dec 2017 09:18:29 +0000 (+0100) Subject: Fixed comparison arithmetic context and comparison order X-Git-Tag: v1.0.0~23^2 X-Git-Url: https://git.p6c8.net/nextcloud-backup-restore.git/commitdiff_plain/2276c3c8aeec9a4a7ae288a3ee99a4123198575d?ds=sidebyside Fixed comparison arithmetic context and comparison order --- 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