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

Re: Filtering array on index



On Thu, Oct 25, 2018 at 4:30 AM Jesper Nygårds <jesper.nygards@xxxxxxxxx> wrote:
>
> I have an array which is the result of using zparseopts on a specification
> that makes it possible to specify several filters with a -v flag. The
> resulting array might look like the following:
>
> myarr=(-v filter1 -v filter2)

What's your spec that produces this array?  Here's my stab at an equivalent:

% set -- -v -v one -v "two -v" -v three -v
% vees=()
% zparseopts -a vees v+::
% print -lr -- $vees
-v
-vone
-vtwo -v
-vthree
-v
% print -lr -- ${vees#-v}
one
two -v
three

What am I missing?



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