Shell Level identify the level of sub-shell in a nested shell
Bash man - Shell Level SHLVL
SHLVL - Incremented by one each time a new instance of Bash is
started.
- This is intended to be a count of how deeply your Bash shells
are nested.
As you can see here
When bash
execute itself the bash shell level is higher in 1
The following recursive call to bash:
$ echo "bash haha" > haha
$ bash haha
Got this message periodically:
bash: warning: shell level (1000) too high, resetting to 1
The meaning of the error above is that bash called itself 1000 times
Another example how $SHLVL variable tracks your shell nesting level:
$ echo $SHLVL
1
$ bash
$ echo $SHLVL
2
$ exit
$ echo $SHLVL
1
Makefile
due to how and where (inside anifneq
clause) I was running commands that would usevagrant ssh -c
, I had to run it within one statement using&&
. Maybe this will help someone.