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

Re: Variable expansion inside of functions



On Sat, Apr 18, 2026 at 7:26 AM Klaus Ethgen <Klaus@xxxxxxxxx> wrote:
>
> >      (( $+commands[$i] )) && cmds+=$i
>
> Sane solution for whence -p. I did not know $+... And I do not find it
> in the documentation. Only ${{+...}} but that is about parameters and
> not about arrays.

Arrays are parameters.  Everything described in the section on
parameters applies to arrays (and associative arrays / hashes) as
well.  The semantics may differ slightly -- sometimes every array
element is affected individually, sometimes the whole array is
examined.  For $+name (which is shorthand for ${+name}), it's the
whole array.




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