Fix arg parsing

This commit is contained in:
Torjus Håkestad 2025-01-27 22:55:20 +01:00
parent 8722afe2c8
commit 945a5ea3dd
Signed by: torjus
SSH Key Fingerprint: SHA256:KjAds8wHfD2mBYK2H815s/+ABcSdcIHUndwHEdSxml4

View File

@ -29,7 +29,9 @@ if [ -n "$BACKUP_HELPER_COMMANDS" ]; then
for pair in "${pairs[@]}"; do for pair in "${pairs[@]}"; do
IFS=":" read -r key value <<< "$pair" 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; exit_code=1;
echo "Backup of $i failed with exit code $?:" echo "Backup of $i failed with exit code $?:"
echo "$output" echo "$output"