First, you can prevent issues with white spaces and quoting by directly sourcing the env file, like this (without $() and cat):
eval $HOME/.config/backup/backup-env.txt
I’d like to ask from the other side first: why should restic expand environment variables in the file passed to --files-from? If restic is started like restic backup $HOME, then the user’s shell will expand $HOME to /home/foo before passing the string to restic, so it’s not restic’s job to do that. We’d need to add special functionality to support this, so I’m interested in your reasoning.
I understand. You are right. It’s not the job of restic to expand environment variables. I want to move the definitions of include/exclude to the files with using of environment variables, but this may be not a good idea. Sorry for the noise.