Zsh Mailing List Archive
Messages sorted by:
Re: Running "unset path" breaks PATH despite emulation being enabled
- X-seq: zsh-users 22876
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Running "unset path" breaks PATH despite emulation being enabled
- Date: Sat, 9 Sep 2017 15:25:12 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=pM2OP6unYFPbsetGLhZa/xRQpC8NJzEZS5KPLU+1ZC0=; b=pPIT/blGTo8t+ShFJAP4YFUNq2uoA4ajQLZvBlWwLeAaKhDAHkCHWN3Kj+ctKRGmLS qovry89C4kN0Z8BvWY14dagbxFC88HEgWX4nYQgVK8WskLKGpFIf9TFMRN5qGhRBZhIV /ZJPECG/zi4oEXGI+LC4/UQMJan5na3YNTsnBl4kygWBi8aC/LDOjVdzdDY1i8j4MKmf iH3hpFwco/sVDEJgbpfdZfOHca6Qk317ajTP7zAFEOxSXja252OcevZW8HqG5/G9nls5 wTLJgtTjnHlSdHRIUH+NVe5UhtXSvjEbfm5OABPn/PYQb0L/5tyEOZ+RTVoeDNVVGYfk NQjw==
- In-reply-to: <email@example.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <firstname.lastname@example.org> <CAHYJk3RD6p7PwRaZSUbJSAE0Bi6_2+NKLC3MV+32Lh+PmzsAdA@mail.gmail.com> <email@example.com>
On Sep 9, 2:38pm, Eric Pruitt wrote:
} Subject: Re: Running "unset path" breaks PATH despite emulation being enab
} I would like to replace "zsh" with the absolute path of the Z shell
} interpreter in case the "zsh" being executed is not the first one listed
} in a $PATH folder. After reading through some documentation and
} reviewing the output of "set", I don't see a way to do this. For
} comparison, Bash sets $BASH to the interpreter's path:
I just had a look at the Bash sources. Chet will correct me if I'm wrong,
but as far as I can tell if argv is not already at least a partial
path, then $BASH is set by doing a path search for the first matching
executable. Thus $BASH will be "the first one listed in a $PATH folder"
when argv contains no "/" separators, even if the actual executable
came from somewhere else.
} Is there a similar value in Z shell or a built-in I can use?
$ZSH_ARGZERO in sufficiently recent versions of the shell will give you
the equivalent information, you just have to do the path search part
yourself, which is simple enough with the "=" expander:
[[ =$ZSH_ARGZERO != =$ZSH_NAME ]] && ...
If NO_EQUALS is set then some uses of `whence ...` might be needed.
Messages sorted by: