Say I start a bash
shell,
...and then another bash
session from within that shell,
...and then another bash
session from within that session,
...and then another bash
session from within that session,
...(times N) etc
To exit all N sessions I have to type exit
N times.
How do I find out how deep I am nested from within any given bash session?
Ideally I'm looking for some environment variable similar to $STY
for screen sessions.
exec
(so that when this terminal closes, the entire XSession ends).$SHLVL
produces two different numbers for these terminals. Is there an environment variable that is more shell-specific? – tetris11 Aug 06 '15 at 13:56$BASH_SUBSHELL
looked promising, but doesn't deliver. – tetris11 Aug 06 '15 at 14:00SHLVL
works..check this solution if it fits.. – heemayl Aug 06 '15 at 14:12SHLVL=0
in~/.xinitrc
. Brilliant, thanks – tetris11 Aug 06 '15 at 14:32