Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Variable expansion inside of functions
- X-seq: zsh-users 30601
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Variable expansion inside of functions
- Date: Sat, 18 Apr 2026 12:55:13 -0700
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=wWMF2XoUE61qC2qhd6Ko9X5RBGojwZhzTMZkoHZsOXQ=; fh=yk3c4scJWo86Za4IR1HBNZw2a+GkUkfVQ7Fs3jnanfg=; b=iIRmiNa38wh8zOGtccx8t4gXuhrxRvMWR+YXEybr8UtDW5d7uiJwqWv+TE429qKkr6 9tykcSJg/2C1RiIc1h7HEAV6ltj5JkJz+o/SEW0Qg98TApHFmCaB5aHbSrqsaRffGIEP sB786uI8i0TFtLf76iExYOXNBBUx+1WNT9ZUS1L2MUz4XD1UMDHLI0bHxJEN7at8goHe S5jT8vymkrCeWzr/lnAv+5PWvIvrzwFQr7QWMt7OQvJETUtPzpkrQUtYAfPvt8eCYNhl WvH0FAEaaYIsJUTMF2WqrvSucBFfaS+lWR1zF3MWCrAqziHRHrHSsqn9a08w11WiVwXm rZyA==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1776542125; cv=none; d=google.com; s=arc-20240605; b=gGJGKOQ/NXd/dYvd90wVL34WzFxX+ZcWYaQDoID1aS/mHS1/1RfLKN1KHmUjsMNa1B yFNit++5f6aBUHwxWluHW/6d0uwJTmTm6fbeuBA1QFaoJxf1WtwVUoaSlSRR3BW8zdns yE84LmYoOPBQ4CvDnZMGJqdcSdeKErO+jzJPlPQiIC31wtqC5NdY9mPJunXhFoFhn0IL msHE+7c9VB++v96HmQLIQC6+Zk+MMse4E2C/A7+WlMbaRjT4q58nGC0KOJmhley6LnPy VS5CCzNdUMOLON7ix7TteFgxklkSwtB3RxFxr+Qol9ldIYyQ7VB5KNVepbfGdmoKa5w0 pf/w==
- Archived-at: <https://zsh.org/users/30601>
- In-reply-to: <aeOUljwEFHiGKZ5j@chil>
- List-id: <zsh-users.zsh.org>
- References: <aeN6GjRBGVWDG6SP@chil> <20260418T135301Z.GLumbW4C--Uw@fnord.qqx.org> <aeOUljwEFHiGKZ5j@chil>
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