[Tutor] getopts question
Kent Johnson
kent37 at tds.net
Fri Mar 30 13:47:58 CEST 2007
Greg Perry wrote:
> Hello List Members,
>
> I am working on a simple program and would like to know the best way
to approach this. Using getops I am parsing the argv array to grab
command line options; from the command line the user can specify either
a filename or a directory (but not both). Is there an eloquent way with
getopts to do an either/or scenario without resorting to multiple tests
to see which variable is set using if then statements?
I'm not really sure what you are looking for here. If you use two
options, you will have to test to see which option is set. You could use
one option, then you will have to test to see if the value is a file or
a directory.
Kent
More information about the Tutor
mailing list