From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13840 invoked by alias); 15 Sep 2016 08:20:24 -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: X-Seq: 21915 Received: (qmail 10685 invoked from network); 15 Sep 2016 08:20:24 -0000 X-Qmail-Scanner-Diagnostics: from mail-qk0-f173.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.220.173):SA:0(0.0/5.0):. Processed in 0.149885 secs); 15 Sep 2016 08:20:24 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: sgniazdowski@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.220.173 as permitted sender) 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fNe2EdEySMdTnh7JtZqEGadbbkEeRFebq0siOMy5pA0=; b=MiaM3QdIlF0ZswR6Qc4fkzOQaMCBu2iVUwe33OchYFl5ZRyi5ZhCH+GXaSMvyw/PZU R/pHCEtYxnKjB2kmcqiGlsxwnoOcDhN3YKBfgEQrfeIjn166P0LWuWi8pTO2RasFdU9O 4twXkKGKfcycajepyCXaurHWHgpBw5E83owOrzLKw0wZnJ6l8FY0nzo4nIDscYGenDZx fGNaJu1xa7Fdkv2upabVaSMuUIKv4K/jecQJ6AINbUHLarquHonfq21899rIvclK1Svr Dtp0UfWP4FEaW6gcm477azeFC/gB9cgCYttv04zm1K9qrztxfT8LEMwP2CowBhU58boy BCJg== X-Gm-Message-State: AE9vXwMtibmEMzN6SieQxXG6G84BYAFGQVCUehkFUMA00jJVwffv5TFahSGs5B/33ruQ4uaFE9vBBW74m3ZOyQ== X-Received: by 10.55.169.193 with SMTP id s184mr7580681qke.3.1473921083492; Wed, 14 Sep 2016 23:31:23 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20160913143042.3907c2b3@pwslap01u.europe.root.pri> References: <20160913140643.56f99ccf@pwslap01u.europe.root.pri> <20160913143042.3907c2b3@pwslap01u.europe.root.pri> From: Sebastian Gniazdowski Date: Thu, 15 Sep 2016 08:31:03 +0200 Message-ID: Subject: Re: How to detect that Zsh startup is result of exec zsh? To: Peter Stephenson Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 On 13 September 2016 at 15:30, Peter Stephenson 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