[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getopts - mutually exclusive flags

From: Chris Jones
Subject: Re: getopts - mutually exclusive flags
Date: Mon, 27 Oct 2008 12:58:55 -0400
User-agent: Mutt/1.5.13 (2006-08-11)

On Sun, Oct 26, 2008 at 08:12:58AM EDT, Chris Jones wrote:
> 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
> I'm trying to use getopts to implement an exclusive OR of the two
> options.
> Incidentally, I am also curious of the "getopts" way to handle the
> absence of _any_ flags.
> Or am I using the wrong tool for the job?
> Thanks!

Sorry about triple-post .. seems all three were delayed some 24+ hours
before they made it to the list.

Hopefully my apologies above won't be delayed :-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]