On 01/05/21 11:09  Andreas Kusalananda K�h�ri wrote:
> On Fri, Apr 30, 2021 at 09:17:47PM +0200, Tilo Stritzky wrote:
> >
> > /etc/netstart contains the following getopts handler:
> >
> > while getopts ":n" opt; do
> >
> > That colon is just totally bogus, isn't it?
>
> The colon at the start of the optstring has the effect that makes the
> getopts utility silent when unsupported options are used.  Instead of
> emitting a diagnostic message ("unknown option"), you'll get a "?" in
> $opt that you can choose to handle yourself (this is taken care of by
> the "*)" case in the code, which calls the "usage" function).

Oh.  I was unaware of this functionality.
After a more careful reading of ksh(1) I conclude the code is correct.

> So it's not "totally bogus".  The question is whether you want to see
> diagnostic messages from getopts when you call /etc/netstart with
> unsupported options in addition to the usage info or not, and it seems
> you're saying you do want to see such a message.

No, everything is fine. I had a brainfart.
I thank you for setting me straight and I apologise for the noise.

tilo

Reply via email to