From: Bart Schaefer <schaefer@brasslantern.com>
To: Peng Yu <pengyu.ut@gmail.com>
Cc: zsh-users <zsh-users@zsh.org>
Subject: Re: The best way to know it is in zsh or bash
Date: Fri, 6 Sep 2019 10:41:48 -0700 [thread overview]
Message-ID: <CAH+w=7aAW+QSof==zCYSRQ-5-qJAThZeYPMgFPDk1EWzuXz+dQ@mail.gmail.com> (raw)
In-Reply-To: <CABrM6w=5V8VnJcX0SNj0s8+EpyJWFqN7EYTYc51rNpTYQ_p9vw@mail.gmail.com>
On Fri, Sep 6, 2019 at 7:42 AM Peng Yu <pengyu.ut@gmail.com> wrote:
>
> Suppose that I start with bash default login shell, then I call zsh.
>
> I'd like to determine whether I am in bash or zsh.
Where/when is it that you want to do this? The two shells have an
entirely distinct set of startup files (except that many packaged
distributions have /etc/zshrc loading /etc/bashrc or similar) so I
take it that it's sometime after that?
> I see ZSH_*
> environment variables. Is ZSH_VERSION the most appropriate to be used
> to test whether it is in zsh or not?
The ZSH_* variables are normally global shell parameters, not exported
to the environment. If something is exporting them, it probably
should not be.
ZSH_VERSION is the oldest of these (if you are worried about
differences within zsh itself), so it should be OK to examine. See
Mikael's answer.
next prev parent reply other threads:[~2019-09-06 17:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 14:41 Peng Yu
2019-09-06 15:11 ` René Wilhelm
2019-09-06 15:38 ` Peng Yu
2019-09-06 15:51 ` gi1242+zsh
2019-09-06 15:16 ` Mikael Magnusson
2019-09-06 17:41 ` Bart Schaefer [this message]
[not found] <CABrM6w=5V8VnJcX0SNj0s8+EpyJWFqN7EYTYc51rNpTYQ_p9vw__33715.8397933067$1567780959$gmane$org@mail.gmail.com>
2019-09-06 19:02 ` Stephane Chazelas
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='CAH+w=7aAW+QSof==zCYSRQ-5-qJAThZeYPMgFPDk1EWzuXz+dQ@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=pengyu.ut@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).