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 21897
- 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: Tue, 13 Sep 2016 15:19: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:content-transfer-encoding; bh=Vv3TcjgVfFjZxaJ68gur8H1t7KjisU6hCF/oWrJ1Q/4=; b=YBf3L7KpZEYbNbZjdWl5Uv6emv6e+y0iRDHYaCAKpxKvlLkIrigidrZc+/F1RT+fR5 eflVoRNHldqNpYDlg/4Uf5zLUDtcVGXj+4tat6rwaeTgEggS7+nIAuljFDWPjfaVyNh1 Yi6f/N2fkSba9Ue3ZvTIc2Bu2kZwtotDmSTBCrNPAE4B/2ham6G7RfEvVfafNwd2AZM8 R7cIl/1t1RFyWO4nDbeqgZnJgOKPbCe9a9B2yStFLw1eXud8T+oAqHqQ/qJZQAlo01lW 5BKFx5KMPV8fc2Da5OgTubqHqUf+1x6zo7qOhDMyWeeSaTTzlgsibXaou768T1zu/XNh pjmA==
- In-reply-to: <20160913140643.56f99ccf@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>
On 13 September 2016 at 15:06, Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
> On Tue, 13 Sep 2016 14:23:23 +0200
> Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
>> Hello,
>> first `exec zsh` can be detected via SHLVL. It will be "1". And some
>> other variable set in .zshrc earlier will be non-zero. But what with
>> `exec zsh` ran from sub-shell?
>
> More widely, in fact, because fork and exec are so basic to UNIX-like
> process handling it's often not possible, and usually not useful, to
> tell this sort of thing apart.
>
> So the real question, as so often, is what you are actually trying to
> do? What makes it necessary that you treat the cases differently? If
> you can address that there may be an answer.
I'm assigning unique ID to every Zsh. If one runs Zsh in side Zsh,
either by exec or by new Zsh, the ID is inherited. However, there's
Tmux. There, ID is not inherited in both cases – person opening new
pane gets new Zsh, with new ID. But the exec case could still inherit
ID – replacing Zsh inside Tmux is fine to inherit ID. That's why I
need to differentiate the two
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author