zsh-users
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Can $_ substitute $0 when nofunctionargzero
Date: Thu, 9 Jun 2016 19:06:44 +0200	[thread overview]
Message-ID: <CAKc7PVBXdgRVMUrZwvDK93BHycPYC7zeafg0=TNmqYEA=xdn+g@mail.gmail.com> (raw)
In-Reply-To: <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@gmail.com> 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


  reply	other threads:[~2016-06-09 17:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-09 16:44 Sebastian Gniazdowski
2016-06-09 17:06 ` Sebastian Gniazdowski [this message]
2016-06-09 18:33   ` Sebastian Gniazdowski
2016-06-09 20:46     ` Bart Schaefer
2016-06-10  6:12       ` Sebastian Gniazdowski
2016-06-15 16:58         ` Sebastian Gniazdowski
2016-06-15 17:40           ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKc7PVBXdgRVMUrZwvDK93BHycPYC7zeafg0=TNmqYEA=xdn+g@mail.gmail.com' \
    --to=sgniazdowski@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).