On Fri, Aug 27, 2021 at 11:33 AM Lawrence Velázquez <v...@larryv.me> wrote: > > On Fri, Aug 27, 2021, at 1:20 PM, nigelberlinguer wrote: > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ > > On Friday, August 27, 2021 4:02 PM, Robert Elz <k...@munnari.oz.au> wrote: > > > XBD 12.2 guideline 7 is: > > > > > > Guideline 7: Option-arguments should not be optional. > > > > > > That is, if you want to be able to give an option arg, or not give one, > > > those should be implemented as 2 separate options. > > > > It should be noted though, that the POSIX requirement by "Guideline 7" > > is not guided by actual portability in the technical sense but by a > > rule written in the POSIX standard. Perhaps there should be an update > > to POSIX on what is actually portable or not > > https://www.opengroup.org/austin/lists.html > > -- > vq >
> I also wonder whether the "shift" command is used with `getopts`. I see > people use > the `shift` command when doing their own parsing; and when others use > `getopt`. $ help shift shift: shift [n] Shift positional parameters. Rename the positional parameters $N+1,$N+2 ... to $1,$2 ... If N is not given, it is assumed to be 1. Exit Status: Returns success unless N is negative or greater than $#. $ help set set: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...] Set or unset values of shell options and positional parameters Change the value of shell attributes and positional parameters, or display the names and values of shell variables. ... -- Ken Irving