How do I handle mutually exclusive flags with getopts? I'm writing a script that normally runs from cron and backs up my hard drive.
But I'd like to be able to run it manually and specify via flags the backup I want to run - daily/incremental or monthly/full. $ backup -d # daily backup $ backup -m # monthly .. So far my best effort still finds the following acceptable: $ backup -dm Although this makes sense - i.e. run the monthly and then run the daily.. I'd still be interested in an exclusive OR of my two flags. Incidentally, I am also curious of the "getopts" way to handle the absence of _any_ flags. Thanks!