getopts optstring name [ arg ... ]
       Checks the args for legal options.  If the args are
       the   positional  parameters.  A valid option argu-
       a `+' or a `-'.  An argument not beginning  with  a
`+' or a  `-',

       or  the argument `--', ends the options.  Note that
       is not considered a valid option  argument.    opt-
       the  letters  that getopts recognizes.  If a letter
       a `:', that option requires an argument.   The  op-
       separated from the argument by blanks.

       Each  time  it  is  invoked, getopts places the op-
       finds in the shell parameter name, prepended with a
`+' when arg

       begins  with  a  `+'.   The  index  of the next arg
       OPTIND.  The option argument, if any, is stored  in

       The  first  option  to be examined may  be  changed
       assigning  to  OPTIND.  OPTIND has an initial value
       normally  reset  to  1 upon exit from a shell func-
       not  reset  and  retains  its value from  the  most
       getopts.   If either of OPTIND or OPTARG is explic-
       remains  unset,  and the index or  option  argument
       The  option  itself is still stored in name in this

       A leading `:' in optstring causes getopts to  store
       any   invalid  option  in  OPTARG,  and to set name
       unknown option and to `:' when a required  argument
       Otherwise,   getopts sets name to `?' and prints an
       when an option is invalid.  The  exit   status   is
       there are no more options.
