Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)
User Commands (g - j) getopts(1)
done
if [ ! -z "$bflag" ]; then echo Option -a specified; fi
if [ ! -z "$bflag" ]; then echo Option -b "bval" specified; fi
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 specification with extensions.
527188-007 Hewlett-Packard Company 4−21