From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: "Lawrence Velázquez" <vq@larryv.me>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: How to detect that Zsh startup is result of exec zsh?
Date: Thu, 15 Sep 2016 20:02:14 +0200 [thread overview]
Message-ID: <CAKc7PVByC8zM9wTw-JDiPu=ZkaewAMEOMqC6w6F6hiLFA0LrUw@mail.gmail.com> (raw)
In-Reply-To: <F7A8408E-B194-4472-B54D-913374398462@larryv.me>
On 15 September 2016 at 19:54, Lawrence Velázquez <vq@larryv.me> wrote:
> You're not actually using any subshells.
>
> % zsh --version
> zsh 5.2 (x86_64-apple-darwin15.6.0)
> % typeset ZSH_SUBSHELL
> ZSH_SUBSHELL=0
> % (typeset ZSH_SUBSHELL)
> ZSH_SUBSHELL=1
> % ( (typeset ZSH_SUBSHELL) )
> ZSH_SUBSHELL=2
> % zmodload zsh/system
> % (( $$ == $sysparams[pid] )); echo $?
> 0
> % ( (( $$ == $sysparams[pid] )); echo $?)
> 1
OK, so this works, but cannot be used to differentiate % exec zsh from
% zsh, however now as I thought about it, it's easy:
% export MYSHLVL=$SHLVL
% zsh
% echo $SHLVL $MYSHLVL
3 2
% exit
% exec zsh
% echo $SHLVL $MYSHLVL
2 2
Best regards,
Sebastian Gniazdowski
prev parent reply other threads:[~2016-09-15 19:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20160913122504eucas1p121867b112b7f08e125a324230d8296df@eucas1p1.samsung.com>
2016-09-13 12:23 ` Sebastian Gniazdowski
2016-09-13 13:06 ` Peter Stephenson
2016-09-13 13:19 ` Sebastian Gniazdowski
2016-09-13 13:30 ` Peter Stephenson
2016-09-15 6:31 ` Sebastian Gniazdowski
2016-09-15 17:54 ` Lawrence Velázquez
2016-09-15 18:02 ` Sebastian Gniazdowski [this message]
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='CAKc7PVByC8zM9wTw-JDiPu=ZkaewAMEOMqC6w6F6hiLFA0LrUw@mail.gmail.com' \
--to=sgniazdowski@gmail.com \
--cc=vq@larryv.me \
--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).