Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zparesopts odd behaviour



On Wed, Oct 27, 2021 at 2:22 PM Oliver Kiddle <opk@xxxxxxx> wrote:
>
> On 2 Sep, Roger Mason wrote:
> > ./testopts.sh  --sc1 5.5 --sc2 5.5 --sc3 8.0 --sc 1.5
>
> zparseopts allows values to appear immediately after the option. So
> --sc3 is taken as being the same as --sc 3
> So it thinks you have four --sc options and only the last is kept.

I'll note that this (which was commented in the script):

zparseopts -D -E -A elkfloats - -sc: -sc1: -sc2: -sc3:

does the expected thing, so I suspect your awk expression to generate
the ${floats} array simply needs to sort its output differently so
that "-sc:" is appears earlier in the array than "-sc1:" etc.




Messages sorted by: Reverse Date, Date, Thread, Author