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). 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. > > > tilo > > Index: netstart > =================================================================== > RCS file: /cvs/src/etc/netstart,v > retrieving revision 1.211 > diff -u -p -r1.211 netstart > --- netstart 23 Dec 2020 17:22:07 -0000 1.211 > +++ netstart 30 Apr 2021 19:14:01 -0000 > @@ -233,7 +233,7 @@ PRINT_ONLY=false > V4_DHCPCONF=false > V6_AUTOCONF=false > > -while getopts ":n" opt; do > +while getopts n opt; do > case $opt in > n) PRINT_ONLY=true;; > *) usage;; -- Andreas (Kusalananda) Kähäri SciLifeLab, NBIS, ICM Uppsala University, Sweden .