rsyncsnap.sh - Bash script for rsync snapshots

recommendation, learn getopts next and replace your homemade version, here's the first google hit: https://sookocheff.com/post/bash/parsing-bash-script-arguments-with-shopts/ (ton more examples out there)

suggestion, learn what exit codes mean - you're exiting with 0 (zero) for all of your error conditions which is incorrect for any app/script. 0 only means success (or other nonop like --version and exit).

while bash does not have a definitive (officially standard) style guide, there are certain norms like line length of 80 and using 2 spaces to indent. Google has a pretty handy guide - it has some items which not everyone agrees on (example, most bash scripters us uppercase for variables, FOO="bar") but it's otherwise pretty good: https://google.github.io/styleguide/shell.xml There's also shellcheck to leverage: https://www.shellcheck.net/ / https://github.com/koalaman/shellcheck (it also has some contentious items, but again 80/20 rule - it's pretty good)

opinion, .include and .exclude are too long for extensions, even in Linux we still sort of use short ones. change those to like .inc and .exc (whatever), I just get.... randomly annoyed looking at you use long extensions like that (it's not a norm). total opinion on my part - go look in your /etc/ and play the 80/20 rule, stick with what is familiar and common. Even .config is shortened to .conf as a social paradigm.

best of luck, keep on banging away at it.

/r/linux Thread