From 07948fe3ca95dbf05f6555b1fb1af64274cf546f Mon Sep 17 00:00:00 2001 From: Gerard Bosch Date: Mon, 11 Dec 2023 23:27:32 +0100 Subject: [PATCH] fix: Linter 2: Shellcheck declare and assign separately --- bin/restic_backup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/restic_backup.sh b/bin/restic_backup.sh index 03a9b24..279ed52 100755 --- a/bin/restic_backup.sh +++ b/bin/restic_backup.sh @@ -52,7 +52,8 @@ warn_on_missing_envvars() { # Log the backup summary stats to a CSV file logBackupStatsCsv() { local snapId="$1" added="$2" removed="$3" snapSize="$4" - local logFile="${RESTIC_BACKUP_STATS_DIR}/$(date '+%Y')-stats.log.csv" + local logFile + logFile="${RESTIC_BACKUP_STATS_DIR}/$(date '+%Y')-stats.log.csv" test -e "$logFile" || install -D -m 0644 <(echo "Date, Snapshot ID, Added, Removed, Snapshot size") "$logFile" # DEV-NOTE: using `ex` due `sed` inconsistencies (GNU vs. BSD) and `awk` cannot edit in-place. `ex` does a good job printf '1a\n%s\n.\nwq\n' "$(date '+%F %H:%M:%S'), ${snapId}, ${added}, ${removed}, ${snapSize}" | ex "$logFile"