getopts optstring name [ arg ... ]
       Checks the args for legal options.  If the args are
       omitted, use the positional  parameters.   A  valid
       option  argument  begins  with  a `+' or a `-'.  An
       argument not beginning with a `+' or a `-', or  the
       argument  `--',  ends  the options.  optstring con
       tains the letters that getopts  recognizes.   If  a
       letter  is  followed  by  a  `:',  that  option  is
       expected to have an argument.  The options  can  be
       separated from the argument by blanks.

       Each  time it is invoked, getopts places the option
       letter  it  finds  in  the  shell  parameter  name,
       prepended  with  a  `+' when arg begins with a `+'.
       The index of the next arg is stored in OPTIND.  The
       option argument, if any, is stored in OPTARG.

       The  first  option to be examined may be changed by
       explicitly assigning to OPTIND.  OPTIND has an ini
       tial  value  of  1, and is normally reset to 1 upon
       exit from a shell function.  OPTARG  is  not  reset
       and  retains its value from the most recent call to
       getopts.   If  either  of  OPTIND  or   OPTARG   is

       explicitly  unset,  it remains unset, and the index
       or option  argument  is  not  stored.   The  option
       itself is still stored in name in this case.

       A  leading `:' in optstring causes getopts to store
       the letter of any invalid option in OPTARG, and  to
       set  name  to  `?' for an unknown option and to `:'
       when a  required  option  is  missing.   Otherwise,
       getopts  sets  name to `?' and prints an error mes
       sage when an option is invalid.  The exit status is
       nonzero when there are no more options.
