Bash manual says
getopts optstring name [args]
When the end of options is encountered,
getopts
exits with a return value greater than zero.OPTIND
is set to the index of the first non-option argument andname
is set to?
.
Does it mean that
getopts
only read in options and option arguments, but not arguments which are neither options nor option arguments?getopts
can't work with the case where in the command line, some options are specified after some arguments which are neither options nor option arguments? In other words, doesgetopts
require that arguments which are neither options nor option arguments be specified after all the options and option arguments?
Thanks.