in reply to Getopt: vs. Getopts confusion

I think I found the important sentence in the description for getopt():
    "Pass one argument which is a string containing
     all switches that take an argument."

So you can give 'ha' to getopts() and it will understand that these options don't take arguments.   To do the same for getopt() you don't mention those options...?   As it was, your mentioning 'h' to getopt() meant that getopt() ate up the next 'value' ('-a') for the option.

If I read it right then getopts('oif:') is matched by using getopt('f').

Replies are listed 'Best First'.
Re: Re: Getopt: vs. Getopts confusion
by knexus (Hermit) on Aug 31, 2003 at 00:23 UTC
    OK, that all makes sense now.

    After reading the doc more carefully and playing with a test script, the difference is apparent... I must have just glossed right over that little point.

    Thanks