From mkssoftware.com:
getopts obtains options and their arguments from a list of parameters that follows the standard POSIX.2 option syntax (that is, single letters preceded by and possibly followed by an argument value; the single letters may be grouped). Typically, shell scripts use getopts to parse arguments passed to them.