]> gitweb.hhaalo.de Git - simple-backup.git/commitdiff
fix no stat for history file not exist
authorBastian Dehn <hhaalo@arcor.de>
Sun, 17 May 2026 17:04:21 +0000 (19:04 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 17 May 2026 17:06:34 +0000 (19:06 +0200)
backup

diff --git a/backup b/backup
index 6656344faa480889954d0b0110a2215329ca9eb8..638048108325ad9b8f9c87810e27bd49f9891ca4 100755 (executable)
--- a/backup
+++ b/backup
@@ -37,8 +37,9 @@ rotate_history()
 {
        local history_file="$1"
 
-       [ -f "$history_file" ] \
-               && history_lines=$(cat $history_file | wc -l)
+       [ -f "$history_file" ] || return 0
+
+       history_lines=$(cat $history_file | wc -l)
        echo "ℹ️  INFO: $history_file has $history_lines lines"
        [ $history_lines -ge 100 ] \
                && savelog -c 10 -l $history_file \