Merge pull request #4 from mmartinortiz/fix-deleting-old-backups
Fixed comparison arithmetic context and comparison order
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user