diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2020-02-16 03:29:19 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2020-02-16 03:29:19 +0100 |
commit | 2794556a41b50f635b6aa49c32fc6ca7bc08c901 (patch) | |
tree | 9557d7a073d4b24e9f10cdc337d9a819eb65ad1a /Doc/help/getopts | |
parent | b0d5cb56971618762ab13dbdb8fb17753f07f0f6 (diff) | |
parent | 94c033d2e281eb1f49e8366d21fc259ce8c0c4f5 (diff) | |
download | zsh-2794556a41b50f635b6aa49c32fc6ca7bc08c901.tar.gz zsh-2794556a41b50f635b6aa49c32fc6ca7bc08c901.zip |
Update upstream source from tag 'upstream/5.8'
Update to upstream version '5.8'
with Debian dir b7a9cb7b782a12a49dca06e06ca2554b5a95bf93
Diffstat (limited to 'Doc/help/getopts')
-rw-r--r-- | Doc/help/getopts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Doc/help/getopts b/Doc/help/getopts new file mode 100644 index 000000000..ef73c55c1 --- /dev/null +++ b/Doc/help/getopts @@ -0,0 +1,30 @@ +getopts optstring name [ arg ... ] + Checks the args for legal options. If the args are omitted, use + the positional parameters. A valid option argument begins with + a `+' or a `-'. An argument not beginning with a `+' or a `-', + or the argument `--', ends the options. Note that a single `-' + is not considered a valid option argument. optstring contains + the letters that getopts recognizes. If a letter is followed by + a `:', that option requires an argument. The options can be + separated from the argument by blanks. + + Each time it is invoked, getopts places the option letter it + finds in the shell parameter name, prepended with a `+' when arg + begins with a `+'. The index of the next arg is stored in + OPTIND. The option argument, if any, is stored in OPTARG. + + The first option to be examined may be changed by explicitly as- + signing to OPTIND. OPTIND has an initial value of 1, and is + normally set to 1 upon entry to a shell function and restored + upon exit (this is disabled by the POSIX_BUILTINS option). OP- + TARG is not reset and retains its value from the most recent + call to getopts. If either of OPTIND or OPTARG is explicitly + unset, it remains unset, and the index or option argument is not + stored. The option itself is still stored in name in this case. + + A leading `:' in optstring causes getopts to store the letter of + any invalid option in OPTARG, and to set name to `?' for an un- + known option and to `:' when a required argument is missing. + Otherwise, getopts sets name to `?' and prints an error message + when an option is invalid. The exit status is nonzero when + there are no more options. |