X-Git-Url: https://git.p6c8.net/nextcloud-backup-restore.git/blobdiff_plain/c560d693f1d4e3f6b842f776a2d7d6a187c5f4c3..b7ca3b60dd6d2ea4fc1e8b84257fa07469a189ee:/NextcloudBackup.sh?ds=inline 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