diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2022-05-14 23:32:19 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2022-05-14 23:32:19 +0200 |
commit | d4d203488826181aa4eb360ce57de138417ba680 (patch) | |
tree | 5f2939130b24381b6d8b11eec7573732eb52317a /Doc/help/getopts | |
parent | 9529af723604dfe1c8152db11e1d216621c898d5 (diff) | |
parent | 73d317384c9225e46d66444f93b46f0fbe7084ef (diff) | |
download | zsh-d4d203488826181aa4eb360ce57de138417ba680.tar.gz zsh-d4d203488826181aa4eb360ce57de138417ba680.zip |
New upstream version 5.9
Diffstat (limited to 'Doc/help/getopts')
-rw-r--r-- | Doc/help/getopts | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Doc/help/getopts b/Doc/help/getopts index bb89d2f2a..ef58eefd4 100644 --- a/Doc/help/getopts +++ b/Doc/help/getopts @@ -1,31 +1,31 @@ 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 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 + 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 + 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 + 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. (The POSIX_BUILTINS option disables this, and also - changes the way the value is calculated to match other shells.) - OPTARG is not reset and retains its value from the most recent - call to getopts. If either of OPTIND or OPTARG is explicitly + 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. (The POSIX_BUILTINS option disables this, and also + changes the way the value is calculated to match other shells.) + OPTARG 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 + 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. |