]> git.p6c8.net - nextcloud-backup-restore.git/commitdiff
Fixed comparison arithmetic context and comparison order
authorManuel <mmartinortiz@gmail.com>
Wed, 27 Dec 2017 09:18:29 +0000 (10:18 +0100)
committerManuel <mmartinortiz@gmail.com>
Wed, 27 Dec 2017 09:18:29 +0000 (10:18 +0100)
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