Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: What's the opposite of ZSH_ARGZERO?
- X-seq: zsh-users 29721
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: What's the opposite of ZSH_ARGZERO?
- Date: Wed, 6 Mar 2024 21:16:27 -0800
- Archived-at: <https://zsh.org/users/29721>
- In-reply-to: <CAMP44s3JuCYoNYQEgVUMwPLwGb7AJSzFF=KLe00v0g_q0z1Kaw@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAMP44s3JuCYoNYQEgVUMwPLwGb7AJSzFF=KLe00v0g_q0z1Kaw@mail.gmail.com>
On Wed, Mar 6, 2024 at 1:57 PM Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
>
> But what if someone wants to do the opposite? Use the zsh $0 even if
> POSIX_ARGZERO is on?
Of course the zsh $0 depends on the setting of FUNCTION_ARGZERO, but I
know what you mean.
> So far I've found that ${(%):-%N} is the best option, but I wonder if
> there is a better one.
$funcstack[1] would be the other option, unless for some odd reason
the zsh/parameter module is not available.
An advantage of $funcstack is that you can use
${${(@)funcstack:#'(anon)'}[1]} to get the name of the nearest
non-anonymous function.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author