bash thinks that it should call the command ~/Desktop with the argument ~/Calibre-Library and the environment variable foo set to the value ~/Documents. It should also print an error. The following shell script demonstrates this:
#!/bin/bash
foo=~/x ~/y ~/z
echo "foo: $foo"
Running it yields:
$ ./x.sh
./x.sh: line 3: /home/fd0/y: No such file or directory
foo:
I’d suggest listing the files/dirs to backup directly after the restic backup command. Otherwise you’ll need to fight with bash until the quoting etc. is right. And that may take some time, good luck
If you want to keep your backup_path variable rather than adding the directories in your backup command (so you can reuse it as you expand your script) you might want to quote the value. Don’t quote the variable in your backup command though.
Thinking about it, it actually looks like restic wants each directory separate, so when it’s passed as one argument in quotes it assumes that is the whole path rather than a string made up of multiple paths. Is this right @fd0 ?