zsh-users
 help / color / mirror / code / Atom feed
From: Eric Pruitt <eric.pruitt@gmail.com>
To: zsh-users@zsh.org
Subject: Re: Running "unset path" breaks PATH despite emulation being enabled
Date: Sat, 9 Sep 2017 14:38:06 -0700	[thread overview]
Message-ID: <20170909213806.52qezvyk766loeg3@sinister.lan.codevat.com> (raw)
In-Reply-To: <CAHYJk3RD6p7PwRaZSUbJSAE0Bi6_2+NKLC3MV+32Lh+PmzsAdA@mail.gmail.com>

I'm moving this discussion from zsh-workers to zsh-users since it's been
established that the behavior I observed isn't necessarily a bug.

On Fri, Sep 08, 2017 at 01:30:05PM +0200, Mikael Magnusson wrote:
> This works fine if you start zsh as sh though, ie either make a
> symlink ln -s =zsh sh; ./sh or do ARGV0=sh zsh
> It can't really work in the 'emulate sh' case since the parameter
> $path is then already created and it would be quite controversial for
> emulate to remove parameters from the shell environment.

What I ended up doing is adding this to the top of my script:

    test "${ZSH_NAME:-sh}" = "sh" || exec -a sh zsh "$0" "$@"

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:

    ~$ echo $BASH
    /home/ericpruitt/.local/bin/bash

Is there a similar value in Z shell or a built-in I can use?

Thanks,
Eric


       reply	other threads:[~2017-09-09 21:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170908082917.v5j4vczoq75vs5lk@sinister.lan.codevat.com>
     [not found] ` <CAHYJk3RD6p7PwRaZSUbJSAE0Bi6_2+NKLC3MV+32Lh+PmzsAdA@mail.gmail.com>
2017-09-09 21:38   ` Eric Pruitt [this message]
2017-09-09 22:25     ` Bart Schaefer
2017-09-09 22:38       ` Eric Pruitt
2017-09-10  9:42         ` Daniel Shahaf
2017-09-10 23:50         ` Bart Schaefer
2017-09-11  4:39           ` Eric Pruitt
2017-09-10 18:51       ` Chet Ramey

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=20170909213806.52qezvyk766loeg3@sinister.lan.codevat.com \
    --to=eric.pruitt@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).