The getopts command parses positional parameters for options.
getopts options name | Checks the positional parameters ($1, $2, etc.) for legal options, based on the value of options, and assigns the result to name. If an option letter is followed by a colon (\Q:'), it requires an argument. See the example at ksh OPTARG Environment Variable. |
getopts options name arguments... | Use the given arguments rather than the positional parameters. |
where: