Joel Kuzmarski
Joel Kuzmarski
I guess I am confused as to why `$SHLVL` doesn't increment for a shell spawned in a subprocess of another shell and whether or not that is a problem or...
The original commit's extended message says: > A top level shell is usually a login shell, but can also be a > non-interactive, non-login shell in certain cases, such as...
Maybe related https://github.com/zsh-users/zsh/blob/master/Functions/Chpwd/chpwd_recent_dirs#L29-L36
``` sh ssh localhost 'echo "$SHLVL $ZSH_SUBSHELL $ZSH_EVAL_CONTEXT $-"' # 1 0 cmdarg 569X ``` ``` sh ssh localhost -t echo "$SHLVL $ZSH_SUBSHELL $ZSH_EVAL_CONTEXT $-" # 1 0 toplevel 059CDEJNQRTVWXZghiklms...
(new terminal tab) ``` sh # 1 0 file 569XZilm cat ~/.zshenv # echo "$SHLVL $ZSH_SUBSHELL $ZSH_EVAL_CONTEXT $-" ``` (within new tab) ``` sh ssh localhost ':;' # 1 0...
(new terminal tab) ``` sh # 1 0 file 569XZilm cat ~/.zshenv # echo "$SHLVL $ZSH_SUBSHELL $ZSH_EVAL_CONTEXT $-" ``` (within new tab) ``` sh zsh # 2 0 file 569XZim...
I can create an iTerm2 profile who's start "Command" is `zsh -i`, and THAT gets me a shell that is interactive AND completely detached from the login shell/environment... The `$SHLVL`...
Another instance where I can trick the test into sourcing `~/.zprofile` multiple times: ``` sh ssh localhost -t "zsh -c 'echo $SHLVL'" ^ ^ | |_ Zsh non-login level 1...
Regarding `(zsh)`: > Looks like a bug. http://unix.stackexchange.com/questions/304917/detect-when-zsh-is-running-within-the-subshell-of-another-shell#comment535643_304917
The most correct behavior I could achieve with a solution confined to `~/.zshenv`: ``` sh ################################################################################ # Source ~/.zprofile ################################################################################ # # Zsh shells can lack an environment due to...