[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: $OPTIND varibale value is different from sh

From: Martijn Dekker
Subject: Re: $OPTIND varibale value is different from sh
Date: Wed, 20 Jun 2018 19:09:09 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

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

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.


- M.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]