From 945a5ea3dddc4baefb2e11ff7ca130304b22ab22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Mon, 27 Jan 2025 22:55:20 +0100 Subject: [PATCH] Fix arg parsing --- backup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backup.sh b/backup.sh index ea34f60..8b8d739 100644 --- a/backup.sh +++ b/backup.sh @@ -29,7 +29,9 @@ if [ -n "$BACKUP_HELPER_COMMANDS" ]; then for pair in "${pairs[@]}"; do IFS=":" read -r key value <<< "$pair" - if ! output=$(restic backup --stdin-filename "$key" --stdin-from-command -- "$value"); then + # Split value into array of command args + IFS=' ' read -r -a cmd_parts <<< "$value" + if ! output=$(restic backup --stdin-filename "$key" --stdin-from-command -- "${cmd_parts[@]}"); then exit_code=1; echo "Backup of $i failed with exit code $?:" echo "$output"