Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to detect that Zsh startup is result of exec zsh?
- X-seq: zsh-users 21915
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- Subject: Re: How to detect that Zsh startup is result of exec zsh?
- Date: Thu, 15 Sep 2016 08:31:03 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=fNe2EdEySMdTnh7JtZqEGadbbkEeRFebq0siOMy5pA0=; b=CjYraJi67XxxFon0FoETLJUNu/wUg/vWoJmZHrrxLYahbLIE3IQbT2oc/iuaLAQm52 vhQz1KwYq1daJahF0jAn1L5pj49s4X98k7XUQ1vz6nL/W7STa7Y8SFrikW3yjbdNbXIl PJlzSsc7Jc39CQFTJU3R5OSxMpuDTMLo7mhdl87B4G81M+I3p0m9k5Z5cFMjCcKrD7Kg 3wz/jziMM2Dhsjq7m+n5dVLGJHJkUV+vHx2rxyI7jZRwhQaScCLTXd4G8CrT/gBfm1lz LQnDqTRguR0AWd19lOjH4vMoH81mubnvGPQHF7ji36OJHSIxK5xGd8D57Ab174eUYLAu kWPA==
- In-reply-to: <20160913143042.3907c2b3@pwslap01u.europe.root.pri>
- 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: <CGME20160913122504eucas1p121867b112b7f08e125a324230d8296df@eucas1p1.samsung.com> <CAKc7PVCErL0ZykRG-72foh8URN1UsO9jvPHuxiCDkum_pooXYg@mail.gmail.com> <20160913140643.56f99ccf@pwslap01u.europe.root.pri> <CAKc7PVAGqeJK=kdpQ9hSBcgpJmn639X94BU0CoNR2m6L2VBfcg@mail.gmail.com> <20160913143042.3907c2b3@pwslap01u.europe.root.pri>
On 13 September 2016 at 15:30, Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
> BTW, telling you're in a subshell when you're still in the parent shell
> is actually easy:
>
> zmodload zsh/system
> if (( $$ == $sysparams[pid] )); then
> print "I'm in the parent shell"
> else
> print "I'm in a subshell"
> fi
>
> However, that's too early for you --- you need to know at the start of
> the new zsh. I think some external mapping to PIDs is the only reliable
> way.
>
> pws
For me the two values are always the same:
https://asciinema.org/a/1tpk0k6jii36iwrzawlr2ador
This reminds me $ZSH_SUBSHELL that Mikael proposed, which is always 0 for me:
https://asciinema.org/a/1jtfup4jrl14w7bps84wupqai
Testing this on IRC bot gave correct result, i.e. "1" was assigned
after running zsh IIRC. So maybe this is OS X issue, maybe even the
same in both cases?
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author