Skip to main content
4 events
when toggle format what by license comment
Jul 4, 2019 at 0:33 comment added cycollins It also means I'm going to take a good hard look at all the "OPT*" variables and either localize them all or at least give some thought as to how having them changed globally would be a risk.
Jul 4, 2019 at 0:31 comment added cycollins Holy s... Ahem.... Well, let's just say that was also a good heads up, because that would have confused me mightily. Though after this above discussion, I might have tried to localize OPTIND just as a defensive measure. So, is the more-fundamental problem here that using getopts in a function, as opposed to a script running as a sub shell is just plain fraught with issues and out of its intended usage model. Seems weird because while it is appropriate for stand-alone script "executables", it's also ideal for use in functions.
Jul 3, 2019 at 19:07 history edited ilkkachu CC BY-SA 4.0
added 798 characters in body
Jul 3, 2019 at 18:38 history answered ilkkachu CC BY-SA 4.0