Re: Running from script - quotes being ignored?
Scott Hannahs via Duplicity-talk <[email protected]>
| Newsgroups | gmane.comp.sysutils.backup.duplicity.general |
|---|---|
| Message-ID | <[email protected]> |
Put a backslash before the single quotes. I don’t know why they show up in the echo command but they have been evaluated in the export command and thus the shell sees the extra gpg option which duplicity interprets as an extra argument. -Scott > On Jul 8, 2025, at 00:59, Andy Hairston via Duplicity-talk <[email protected]> wrote: > > I'm sure this is more of a bash scripting issue, but I'm pretty well stuck. I've been running duplicity via bash scripts for several years, and went to add an option to specify compression level - and now the script won't work. Here's the script, minus some private items (and boiled down to just what is needed to reproduce the issue): > > export B2BUCKET=[snip] > export DUPLICITY_CMD="pipx run duplicity" > BACKUP_COMMAND="$DUPLICITY_CMD backup --gpg-options='--compress-algo=bzip2 --bzip2-compress-level=9'" > echo -E $BACKUP_COMMAND /home/[snip] ${B2BUCKET} > $BACKUP_COMMAND /home/[snip] ${B2BUCKET} > > If I run this, I get: > pipx run duplicity backup --gpg-options='--compress-algo=bzip2 --bzip2-compress-level=9' /home/[snip] [snip] > CommandLineError: Wrong number of positional args for 'backup', got 3 > Expected 2 positionals from ["--bzip2-compress-level=9'", '/home/[snip]', '[snip]']. > Enter 'duplicity --help' for help screen. > > But if I copy the outputted line "pipx run duplicity ...", paste it into the command line, and run it, it runs fine. It's almost like the single-quotes around the gpg-options are being ignored, passing only the --compress-algo=bzip2 argument to gpg-options, and saving the bzip2-compress-level option for duplicity's backup command. > > I know I could put the entire thing on one line, but I had split it into command and arguments due to running multiple commands (remove-older-than, for instance). This works, and is my temporary workaround: > $DUPLICITY_CMD backup --gpg-options='--compress-algo=bzip2 --bzip2-compress-level=9' /home/[snip] ${B2BUCKET} > > Any idea what I'm doing wrong in my export commands, causing the quotes to be ignored? > -- > > Andy Hairston > _______________________________________________ > Duplicity-talk mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/duplicity-talk _______________________________________________ Duplicity-talk mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/duplicity-talk