fix error

fix error message if less than 5 backups exist
This commit is contained in:
SgtBatten 2019-02-09 17:49:41 +11:00 committed by taniman
parent e5038c0d0f
commit 844452a623
1 changed files with 5 additions and 1 deletions

View File

@ -397,5 +397,9 @@ if [ -n "${1}" ]; then
fi
### Remove all but the 5 most recent backups ###
ls -dt "$DIR"/updatescript/*/ | tail -n +6 | xargs rm -r
if [ "$(ls -ld $DIR/updatescript/* | wc -l)" -gt 5 ]
then
ls -dt "$DIR"/updatescript/*/ | tail -n +6 | xargs rm -r
echo "Removed old backups from updatescript folder."
fi