]> git.p6c8.net - nextcloud-backup-restore.git/commitdiff
Merge pull request #4 from mmartinortiz/fix-deleting-old-backups
authorDecaTec <DecaTec@users.noreply.github.com>
Wed, 27 Dec 2017 10:30:36 +0000 (11:30 +0100)
committerGitHub <noreply@github.com>
Wed, 27 Dec 2017 10:30:36 +0000 (11:30 +0100)
Fixed comparison arithmetic context and comparison order

NextcloudBackup.sh

index 38de99584c1965757cfe73d361d5def1e22ae134..dae6e7faf489533826c9573910186791254602d7 100644 (file)
@@ -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

patrick-canterino.de