Open System Services Management and Operations Guide (G06.25+, H06.03+)
Managing With the Shell
Open System Services Management and Operations Guide—527191-002
9-11
Parsing Command Options With the getopts
Command
Parsing Command Options With the getopts
Command
The getopts command is used only in shell scripts, not at the shell prompt. It parses
command options and checks a specified command for legal options. Each time it is
invoked, getopts places the next option letter it finds into a variable name that you
specify. You can also specify letters that the getopts command is to recognize as
valid option values and an option argument to parse.
The getopts command differs from regular OSS shell commands in that it does not
open a new shell process when it executes.
For more information about the getopts command, see the getopts(1) reference
page either online or in the Open System Services Shell and Utilities Reference
Manual.