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


Groups > gnu.bash.bug > #14257

Re: $OPTIND varibale value is different from sh

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Martijn Dekker <martijn@inlv.org>
Newsgroups gnu.bash.bug
Subject Re: $OPTIND varibale value is different from sh
Date Wed, 20 Jun 2018 19:09:09 +0100
Lines 20
Approved bug-bash@gnu.org
Message-ID <mailman.2309.1529518159.1292.bug-bash@gnu.org> (permalink)
References <ea25c4c012ab73dff24d28714d4bd8@cweb13.nm.nhnsystem.com> <20180620123950.i6etdbcjgodbfse6@eeg.ccf.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1529518159 18494 208.118.235.17 (20 Jun 2018 18:09:19 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.7.0
In-Reply-To <20180620123950.i6etdbcjgodbfse6@eeg.ccf.org>
Content-Language en-GB
X-detected-operating-system by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-Received-From 37.59.109.123
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
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 <http://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>
Xref csiph.com gnu.bash.bug:14257

Show key headers only | View raw


Op 20-06-18 om 13:39 schreef Greg Wooledge:
> I really don't understand what you're doing here, either.  The only
> use of OPTIND is after the final call to getopts, when there are no
> more options to process.  At that point, OPTIND tells you how many
> times you have to "shift" to get rid of all the options that were
> processed.  (And you have to subtract 1, because legacy historical
> reasons.)

In other words, because all the options have now been processed, OPTIND 
points to the first argument *after* the list of options. I don't see 
how that is "because legacy historical reasons". It seems both logical 
and useful to me.

> Any attempt to use OPTIND in the middle of the loop seems pointless
> and hazardous to me.

Agreed.

- M.

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


Thread

Re: $OPTIND varibale value is different from sh Martijn Dekker <martijn@inlv.org> - 2018-06-20 19:09 +0100

csiph-web