Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: The best way to know it is in zsh or bash
- X-seq: zsh-users 24224
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Peng Yu <pengyu.ut@xxxxxxxxx>
- Subject: Re: The best way to know it is in zsh or bash
- Date: Fri, 6 Sep 2019 10:41:48 -0700
- Cc: zsh-users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4U9FEjjv/htYmDUQL4ZKAF7F4iP6JY4WcYHSmwTfz9A=; b=1gEK21oRWnGXp25+JJEatJOcSfZi+Ks9iwMVSqtsgLeEPMTxpF4eSp7reoWs127dDm pkdVqjRC/fKbo6Z+gcQEjOV58DwbVDEOVnx+XQkq+UXOW3u4pjNCxDlYNeD+P61nZEd4 7FLn2s/Q518KujPmXKSk1oLBOsqRlor8b+sPHzVilM5zzfSB7PiQc4as3OWcDEyVULX9 GYZelLUgHu1JcsIqhgzmok6hOdVGq216gzDugt2k92cNGszXLXj33DEx8fx4Rnlwirpd OMFsY2WRyXo/zqiJq795jBHspQmCEoVi3KaVyC1TO2pvV4bCH3EVYr8Q5tdnnMR4QEWu E/0g==
- In-reply-to: <CABrM6w=5V8VnJcX0SNj0s8+EpyJWFqN7EYTYc51rNpTYQ_p9vw@mail.gmail.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>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CABrM6w=5V8VnJcX0SNj0s8+EpyJWFqN7EYTYc51rNpTYQ_p9vw@mail.gmail.com>
On Fri, Sep 6, 2019 at 7:42 AM Peng Yu <pengyu.ut@xxxxxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author