mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-24 17:00:32 +02:00
48614: getopts: Calculate OPTIND according to POSIX_BUILTINS
This commit is contained in:
parent
2da0d8b52f
commit
c23a0d84b0
6 changed files with 52 additions and 2 deletions
|
|
@ -982,7 +982,8 @@ vindex(OPTARG, use of)
|
|||
The first option to be examined may be changed by explicitly assigning
|
||||
to tt(OPTIND). tt(OPTIND) has an initial value of tt(1), and is
|
||||
normally set to tt(1) upon entry to a shell function and restored
|
||||
upon exit (this is disabled by the tt(POSIX_BUILTINS) option). tt(OPTARG)
|
||||
upon exit. (The tt(POSIX_BUILTINS) option disables this, and also changes
|
||||
the way the value is calculated to match other shells.) tt(OPTARG)
|
||||
is not reset and retains its value from the most recent call to
|
||||
tt(getopts). If either of tt(OPTIND) or tt(OPTARG) is explicitly
|
||||
unset, it remains unset, and the index or option argument is not
|
||||
|
|
|
|||
|
|
@ -2249,7 +2249,8 @@ command found in the path.
|
|||
|
||||
Furthermore, the tt(getopts) builtin behaves in a POSIX-compatible
|
||||
fashion in that the associated variable tt(OPTIND) is not made
|
||||
local to functions.
|
||||
local to functions, and its value is calculated differently to match
|
||||
other shells.
|
||||
|
||||
Moreover, the warning and special exit code from
|
||||
tt([[ -o )var(non_existent_option)tt( ]]) are suppressed.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue