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


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

Re: $OPTIND varibale value is different from sh

Started byMartijn Dekker <martijn@inlv.org>
First post2018-06-20 19:09 +0100
Last post2018-06-20 19:09 +0100
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: $OPTIND varibale value is different from sh Martijn Dekker <martijn@inlv.org> - 2018-06-20 19:09 +0100

#14257 — Re: $OPTIND varibale value is different from sh

FromMartijn Dekker <martijn@inlv.org>
Date2018-06-20 19:09 +0100
SubjectRe: $OPTIND varibale value is different from sh
Message-ID<mailman.2309.1529518159.1292.bug-bash@gnu.org>
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.

[toc] | [standalone]


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


csiph-web