From c84a5702b2d26523fc4808df31b2cf66ebe12a63 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal <40464775+daniel156161@users.noreply.github.com> Date: Sat, 22 Aug 2020 02:29:22 +0200 Subject: [PATCH] Update backup.sh --- backup.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backup.sh b/backup.sh index 135399f..120b966 100755 --- a/backup.sh +++ b/backup.sh @@ -63,6 +63,9 @@ do_backup if [ ! -z $keepfiles ]; then remove=$(ls -d -1tr $destination/*.xml | tail -n +$keepfiles | head -n1) if [ ! -z $remove ]; then - rm -f $(ls -d -1tr $destination/*.xml | tail -n -$keepfiles | head -n1) + keepfiles=$((keepfiles + 1)) + del=$(ls $destination/*.xml | tail -n -$keepfiles | head -n1) + rm -f $del + echo "Backup removed at $del" fi fi