Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Running "unset path" breaks PATH despite emulation being enabled
- X-seq: zsh-users 22892
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Running "unset path" breaks PATH despite emulation being enabled
- Date: Sun, 10 Sep 2017 16:50:57 -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=I+N3waR3CXuxWt2vLybmxU9b9PJ0A0bufGXIuOO45ts=; b=XhKrpx9hQitagymKlIUl4dydR0KELyDrJO292t7FlgebqMe8EKeBMw0bJmEdQuuUET v7bDoZtA3XyqsESxSO/Lr/1oGQb4BYJFiEc9yLeFmxZendoHk3Ins5cZ4eaJHbWTa037 3Hdgnzpv6orsH6D/udRJpkkm87yqWDrHkexwrVfbae8x/r9qAJ/958y6YJajmZjJowId xGNW517B7WlsTizLUr8Qi2bskZ8kXkOI1Yi7GbiDOKUuQV0Mo8B8YksU/X9uUGMGK20C rcxaFi9MWetbnumUsh8SyGKATqT6ObhAtXLr++Gc7et1C0RhkrF+uzVQiv+k03IXvj0E Ej7A==
- In-reply-to: <20170909223811.mjaoafbhugrijnyb@sinister.lan.codevat.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: <20170908082917.v5j4vczoq75vs5lk@sinister.lan.codevat.com> <CAHYJk3RD6p7PwRaZSUbJSAE0Bi6_2+NKLC3MV+32Lh+PmzsAdA@mail.gmail.com> <20170909213806.52qezvyk766loeg3@sinister.lan.codevat.com> <170909152512.ZM9176@torch.brasslantern.com> <20170909223811.mjaoafbhugrijnyb@sinister.lan.codevat.com>
On Sep 9, 3:38pm, Eric Pruitt wrote:
}
} What want is for Z shell to return is the name to the invoked
} interpreter which is what $BASH shows even when $PATH doesn't contain
} Bash.
OK, that's just a little bit trickier. Here's script equivalent of the
actual heuristic Bash uses:
# Set $ZSH the way Bash sets $BASH
get_ZSH() {
emulate -L zsh
if [[ -o login && $ZSH_ARGZERO != /* ]]
then ZSH=$SHELL
elif [[ $ZSH_ARGZERO = /* ]]
then ZSH=$ZSH_ARGZERO
elif [[ $ZSH_ARGZERO = ./* ]]
then ZSH=$ZSH_ARGZERO:P
else
local -a tname=( $^path/$ZSH_ARGZERO(N[1]) )
if [[ -z $tname ]]
then
if [[ -x $ZSH_ARGZERO ]]
then ZSH=$ZSH_ARGZERO:P
else ZSH=$SHELL
fi
else
ZSH=$tname:P
fi
fi
}
This only works if it's executed before any chdir has been done.
For older zsh that don't have the :P modifier, use :A.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author