ggeettooppttss -- Command

Parse command-line options
ggeettooppttss _o_p_t_s_t_r_i_n_g _n_a_m_e [ _o_p_t ]

The command  ggeettooppttss parses a  command's options and  check their legality.
_o_p_t_s_t_r_i_n_g must  contain the options letters that  the command using ggeettooppttss
will recognize.  If  a letter is followed by a  colon `:', that option must
have an argument that is separated from it by whitespace.

Each time  it is  invoked, ggeettooppttss  places the next  option into  the shell
variable _n_a_m_e and  the index of the next argument  to be processed into the
shell variable  OOPPTTIINNDD, which  is initialized by  default to one.   When an
option  requires an  argument, ggeettooppttss  copies it  into the  shell variable
OOPPTTAARRGG. If ggeettooppttss encounters an error, it initializes variable _n_a_m_e to ?.

When  it encounters  the end  of the options,  ggeettooppttss exits  with non-zero
status.  The  special option  ``--'' can  be used to  delineate the  end of
options.

_E_x_a_m_p_l_e
The following example  processes a command that takes options  aa, bb, and oo;
the last option requires an argument:

    while getopts abo: c
    do
        case $c in
            a|b)    FLAGS=$FLAGS$c;;
            o)  OARG=$OPTARG;;
            \?) echo $USAGE 1>&2
                exit 2;;
        esac
    done
    shift OPTIND-1

This code will accept any of the following as equivalent:

    cmd -a -b -o"xxx z yy" file
    cmd -a -b -o"xxx z yy" -- file
    cmd -ab -o"xxx z yy" file
    cmd -ab -o"xxx z yy" -- file

Note that no space is required between -oo and its argument.

_S_e_e _A_l_s_o
ccoommmmaannddss, ggeettoopptt(), kksshh

_N_o_t_e_s
Under COHERENT  4.0, ggeettooppttss worked  only under the  Korn shell.  Beginning
with COHERENT release 4.2, it works under both the Korn and Bourne shells.
