I wrote a bash script that can do an incremental and full backup of the current users $HOME directory. it works for the most part, the one thing I can’t seem to get working is to get it to accept arguments to determine if it does a full back up, incremental back up, or just print out help info. The current way I have it set up is with getopts:
while getopts "o:ifn" opt; do case "$arg" in o ) output="$OPTARG"; ;; i ) btype="incremental"; ;; f ) btype="full"; ;; n ) noinc=1; ;; ? ) usageQuit ;; esac done
I know it does not accept “–” as valid flags, but no matter if I do “-f” or just “f” the script runs the defaulted incremental backup. If you need more of the code I will be happy to post/send it to you.
Thank you for the time