Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to detect that Zsh startup is result of exec zsh?
On 15 September 2016 at 19:54, Lawrence Velázquez <vq@xxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author