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


Groups > gnu.bash.bug > #15369

Re: Wrong explanation of getopts

Path csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Eduardo Bustamante <dualbus@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Wrong explanation of getopts
Date Sun, 15 Sep 2019 13:38:33 -0700
Lines 20
Approved bug-bash@gnu.org
Message-ID <mailman.305.1568579929.2190.bug-bash@gnu.org> (permalink)
References <0bc4f0f2-863d-5c42-76d8-857f74a1d8fa@gmx.de> <CAOSMAutc4KFan0Rorc7TgQVneRovpe21m+yi8nqwk=CBR5cwWw@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1568579930 2439 209.51.188.17 (15 Sep 2019 20:38:50 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash <bug-bash@gnu.org>
To Roland Illig <roland.illig@gmx.de>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RQp9pfPQaHPanmhdul+/zOzFVKEfzbdYEDAmi/75ujo=; b=bybGdv5rEdzKfG83nuaL5VhiagC2Y5N/jMNK6IEfL8rjPZ0rqQ5zrZqAiZpOw3MEBQ JT1Br1lR8/w4Ekztl/WowMsdpiM/3knRisU/+/JhQBi+hdhv2oFq1Yqvct/XugNk332U 9cSxl+jHNodfMXPh1tZQ+cXqVL3ZlG3mq/K2LeADnwmxieeB79MzEGIvH0fmatxM0aQb Jn7RG9xRL6UioGjbiPX3IMqOdFs9Tj150YXVDLbDj0XbM7mpRk3DhLe4DmphluWXmjod fAwqEpbvYoAoAhWaaZfDLttV5APAp3IevAPnkjzWKGf/okssX0bJx1px+2y6my/Y6T6G cJIw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RQp9pfPQaHPanmhdul+/zOzFVKEfzbdYEDAmi/75ujo=; b=rV1I2FbkoGq0fcnoGR0qL0nPRBnuvJgnwWA5IDsWsNtB+WxS4Zaq3zlQh2bGa7ZxtT KKcVhPcYmsu5aAt7AVYVla9F1CUuNwtzx72O11g/jxtDT/zAaPcMXdll/bS62SFADHn5 xac2XtaNh1GnTO2v3okeDQZeyBQc62JEzdkqtj3T28Ngck3/qsYkz86RjqtUZ5ol9YWa Bv67rPAoFTwcMYP/gFON4L7Ft+LInHPHGx1k2AhvbfcN8zf8B7pZxhkGd8QaNHSPRqMa CSDS+M6bP9OU1d1ogBOd0YzGeraLVuhULFpzLA66U+jS52oFVbxm3aUvOcDnjZxUqM46 YdYA==
X-Gm-Message-State APjAAAW3mV65zarwc2ufQJJBexiNW+2l7HZ4i/+TAa/5Vy9QWTRWRPNy bjygb3uZFUimtaqsk6k0Cjo3lpUtCMkL+9b4HQ4=
X-Google-Smtp-Source APXvYqzh87IXKNSSqJ8OT5U/5rI3u/ELYPSiWJ1GxUSjbKQ9DCd49hwcJAer65jxWT6aYpkXVoHgl1/yC9ESlnZBmaA=
X-Received by 2002:a67:fc41:: with SMTP id p1mr30286819vsq.20.1568579924934; Sun, 15 Sep 2019 13:38:44 -0700 (PDT)
In-Reply-To <0bc4f0f2-863d-5c42-76d8-857f74a1d8fa@gmx.de>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4864:20::e29
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAOSMAutc4KFan0Rorc7TgQVneRovpe21m+yi8nqwk=CBR5cwWw@mail.gmail.com>
X-Mailman-Original-References <0bc4f0f2-863d-5c42-76d8-857f74a1d8fa@gmx.de>
Xref csiph.com gnu.bash.bug:15369

Show key headers only | View raw


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. $@).

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web