Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Can $_ substitute $0 when nofunctionargzero
- X-seq: zsh-users 21635
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Can $_ substitute $0 when nofunctionargzero
- Date: Thu, 9 Jun 2016 19:06:44 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=Zw8U09PYcJwBYhs10ayE//48eGlUocDdIA9tpk0jZn4=; b=NdZu1h/H4CKDyOrbvzl6S9zV+I2NlEuEoEPslXGD7IEEjPZ/4bJ0rSYUsrXvf+6xYx xSWk0HFlHq3T4A+uSR4XuZcsdGOkN33J+dMaxIESIzWCapttyu5MceE6C2fglBpj0Qd4 mZ9Q/eda54bhIiXRjhhVkwqSZzXV9PFcghv9JAESpuPgnL/QdWiQVllD7BrM2rh6eR7H KoDwkUZEffCtCDET34D00kyok3KIphCyOEwVM8kNZMwzaJ8DtV/RPlpNrwuyZOWwRCCD UzTWFFvw6wbe6AiYQqwz8LtJEnTit0DCX1Z5FnvB4QUJGSneGJEqQaOco6xhBBfj6Yll 9ZzQ==
- In-reply-to: <CAKc7PVB4y+dw+0Ox76_YTrzwT1C9sRp2=iX1-JkbPQEUQqe77w@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVB4y+dw+0Ox76_YTrzwT1C9sRp2=iX1-JkbPQEUQqe77w@mail.gmail.com>
Hello,
documentation says: "The last argument of the previous command.
Also, this parameter is set in the environment of every command
executed to the full pathname of the command."
Turns out it's the first sentence that happens. Last argument to
`source' is substituted for $_. But in real word, $_ can still be used
when option functionargzero is unset, unless someone will came up with
a standard of how plugins can be parametrized – they're normally
sourced without any additional arguments.
Any more flaws in this?
Best regards,
Sebastian Gniazdowski
On 9 June 2016 at 18:44, Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> Hello,
> this (one line):
> mkdir -p pathcomponent; echo 'echo "0: $0, _: $_";' >
> pathcomponent/sourceme; setopt nofunctionargzero; source
> pathcomponent/sourceme
>
> outputs:
> 0: /bin/zsh, _: pathcomponent/sourceme
>
> So it looks like $_ can take back what nofunctionargzero takes away:
> path to sourced file. Normally $0 is used in many plugins, making them
> incompatible with nofunctionargzero. Z-sy-h has an explicit check for
> this and does:
>
> echo "zsh-syntax-highlighting: error: not compatible with
> NO_FUNCTION_ARGZERO" >&2
>
> Can $_ take over? This would mean such scripts can be compatible with
> emulate sh and ksh.
>
> Best regards,
> Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author