Relevant manual page in case anyone's interested: https://restic.readthedocs.io/en/latest/045_working_with_rep...
export $(sudo cat <protected_credentials_file> | xargs)
Is that the same as sudo cat f | xargs export?If so, I think an important difference is that mine won't hide the exit code, and you can then answer a sibling commenter (on forgetting without checking) with 'I omitted set -e at the top'.
It looks like in this example it's used simply to trim whitespace. E.g.
$ echo ' hello ' | xargs
hellorestic -r <repo_name> --verbose --exclude="$HOME/snap" --exclude="$HOME/Android" --exclude="$HOME/.android" --exclude="$HOME/ApkProjects" backup ~/
To me if it requires complicated shell commands it is not really "done right".
The snippet GP mentioned includes only shell functions, invocations of restic, and echo commands. How could it be simpler?
Simple for someone who is comfortable with the terminal. Scary for those who are oyherwise familiar with GUIs only.
It makes it hard for me to recommend backup tools to the non-technical people in my life, because they're looking for GUI solutions with the corners rounded off, and I want something crunchy and scriptable.
A lot of backup services (tarsnap comes to mind) prioritize scriptability, as I imagine many people run backups from cron or a systemd timer.
GUIs for simple stuff and 99% of the population, CLIs for hackermans who need the advanced stuff.
# tar cvf /dev/st0 .
restic -r reponame /path-to-files-to-be-backuped
Everything else in the mentioned script is optional stuff for scheduling, removing old backups, etc.