Open System Services Shell and Utilities Reference Manual (G06.25+, H06.03+)

getopts(1) OSS Shell and Utilities Reference Manual
done
if [ ! -z "$bag" ]; then echo Option -a specied;
if [ ! -z "$bag" ]; then echo Option -b "bval" specied;
shift $[OPTIND - 1]
echo Remaining parameters are: "$*"
NOTES
The getopts command is a shell built-in command. It differs from the regular commands in that it
does not open a new shell process when it executes.
A general discussion of shell built-in commands and a list of the OSS shell built-in commands
are in the sh(1) reference page.
EXIT VALUES
The getopts command returns the following values:
0 (zero) The command completed successfully.
>0 An error occurred or there are no more options.
RELATED INFORMATION
Commands: sh(1).
STANDARDS CONFORMANCE
This command conforms to the XPG4 Version 2 specication with extensions.
418 Hewlett-Packard Company 527188-003