I do something similar to this. My right prompt shows a small fork symbol when I&#x27;m in a sub-shell (based on $SHLVL). However, this does not help me much when I&#x27;m several levels deep, which is why eventually I started hooking in on changes to $PWD.