Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15369 > unrolled thread

Re: Wrong explanation of getopts

Started byEduardo Bustamante <dualbus@gmail.com>
First post2019-09-15 13:38 -0700
Last post2019-09-15 13:38 -0700
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Wrong explanation of getopts Eduardo Bustamante <dualbus@gmail.com> - 2019-09-15 13:38 -0700

#15369 — Re: Wrong explanation of getopts

FromEduardo Bustamante <dualbus@gmail.com>
Date2019-09-15 13:38 -0700
SubjectRe: Wrong explanation of getopts
Message-ID<mailman.305.1568579929.2190.bug-bash@gnu.org>
On Sun, Sep 15, 2019 at 12:58 PM Roland Illig <roland.illig@gmx.de> wrote:
>
> The help text of getopts says:
>
> >   Getopts normally parses the positional parameters ($0 - $9), but if
> >   more arguments are given, they are parsed instead.
(...)
> The "instead" in "they are parsed instead" is totally wrong. $1 to $9
> are always parsed, no matter if there are more than 10 positional
> parameters or not.

It's not wrong.

> $ getopts
> getopts: usage: getopts optstring name [arg]

It's referring to the fact that you can explicitly pass a set of
parameters to `getopts' (i.e. the `[arg]' part), instead of it using
the script's positional parameters (i.e. $@).

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web