From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id b603fbda for ; Sat, 7 Sep 2019 00:32:36 +0000 (UTC) Received: (qmail 8892 invoked by alias); 6 Sep 2019 19:03:10 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24229 Received: (qmail 11099 invoked by uid 1010); 6 Sep 2019 19:03:10 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm1-f52.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25559. spamassassin: 3.4.2. Clear:RC:0(209.85.128.52):SA:0(-2.0/5.0):. Processed in 4.381576 secs); 06 Sep 2019 19:03:10 -0000 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.128.52 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=rxG+ZPJdGWXKXjfgD+8JKhevKsG21ojuJXWK4eKbN7A=; b=L76IUS9Oydiz1wazKZhFNsXCeToAUtRrhXKVnew8GpI0z0wbB8dAUvgcBWzKanvFhI sf8yGbMSHgw9FDYcrzHAmr2iUS12iRbyE5U5qHhF6PtbCX6C/OaAvV1L8Hys1oIKONv4 wxrt/Kbt0wQaocsgnZGLLtReDPVZQVuuN9nwAk+xX8C6813LkE6kzArQPu5xb+xHjyuQ XeDTbnv8/TsFcjw9JD2fiOZ6Vre1s5/aO4vJsO+4jYMpMWHt9OC947SaWwPtK8V6u3bJ HgXKwD+6+ha1IhuqGsBaOp3ggyfPZwMmfBN8N5/IU00fNGsKVznDo/shfKRsLTl0fGM3 Njvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=rxG+ZPJdGWXKXjfgD+8JKhevKsG21ojuJXWK4eKbN7A=; b=WcKi4dBOVQGECizXiHz0VMi2B/0W+zTCauKeI8Xavjq5toYVpcf08UM96hlF9ipZOD E2e0uuxukrmFl7YZMC3+30No38GbqV9xu/rCWwc2lJVVPInNp3eIdjCRtZ13DJ14DqC0 7CAPylEDVlP+R8gJT2SylqVENp9+aUZsmd4oxeud0MQ/uuCajgZVG4SBecbauD2N1vIh qsLCRzoonPVBcVUed1+5fzu4xITkImmHmZ0xU7redKOGS9skSAzEeB5Ey0Ue8YgLLziq C3VizqoAh5c5fGEL61/PKfAhfilnQn25t8qi3mkinQSL7r0HUXqal/qot+v0ItT3Irkk Rx2Q== X-Gm-Message-State: APjAAAWKBDBjbQM2tgfGdEPy3MrLtMoz/xCZmSSc5QxeEipIhpZfN6QC QMtf8nppoMofUVN3gGWYXKTzG2obFzA= X-Google-Smtp-Source: APXvYqy99mEgqiskKQIwHn7u3ft9CejR+bdiMmbWR5siEgiqA20KGyGKGpDeNGRIWqiUPtTSIJsBUA== X-Received: by 2002:a7b:c752:: with SMTP id w18mr8432121wmk.63.1567796551956; Fri, 06 Sep 2019 12:02:31 -0700 (PDT) Date: Fri, 6 Sep 2019 20:02:29 +0100 From: Stephane Chazelas To: Peng Yu Cc: zsh-users Subject: Re: The best way to know it is in zsh or bash Message-ID: <20190906190229.ouynwukrobao3cbq@chaz.gmail.com> Mail-Followup-To: Peng Yu , zsh-users References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 2019-09-06 09:41:22 -0500, Peng Yu: > 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. I see ZSH_* > environment variables. Is ZSH_VERSION the most appropriate to be used > to test whether it is in zsh or not? Thanks. > > $ declare -p BASH_VERSION > declare -- BASH_VERSION="5.0.0(1)-release" > $ declare -p ZSH_VERSION > typeset ZSH_VERSION=5.6.2 [...] Just run ps or maybe ps -H (HP/UX, procps): ~$ ps -H PID TTY TIME CMD 32057 pts/13 00:00:00 zsh 32123 pts/13 00:00:00 ps ~$ bash bash-4.4$ ps -H PID TTY TIME CMD 32057 pts/13 00:00:00 zsh 32124 pts/13 00:00:00 bash 32125 pts/13 00:00:00 ps ps -o comm= -p "$$" Will show you the name of the process of id $$ (the pid that executed the shell). -- Stephane