BASH How Many Shells Deep am I Linux Shell Tutorial

preview_player
Показать описание


This Video Brought to you by:
Rashid - Patreon supporter
Рекомендации по теме
Комментарии
Автор

This is great Kris, I've always wanted a way to know this w/o having to use htop or pstree and manually having to count or look for the pid in the tree.
There is, however, at least one 'cotcha' - in my case, I use i3-gaps with the st terminal in archlinux, and it turns out my top level terminal (default container in i3) is at level 2...looking at pstree, it appears the top terminal is a child process of st - I did not realise this until now.
this level 2 at the top seems also true for terminals in tmux sessions - I've too often accidentally closed the last terminal and lost the session! so this could definitely help
Great little info-nugget, thanks : )

geoptus
Автор

This actually is a useful thing to know. I am definitely going to create an alias for this . Especially in a mobile phone terminal I hate typing on that little keyboard as it is. Exiting on accident is frustrating . Depending on the app you may have to re-launch it again or type in long usernames & passwords just because you typed exit 1 to many times. Things can become increasingly confusing when switching back and forth between Root & your regular user. Good stuff Kris

DDBAA
Автор

Interesting, I am not advanced enough to be calling BASH within BASH as my scripts are pretty basic, but If I found myself doing that I might put SHLVL into my PS1 prompt.

Kenobi
Автор

Try bash, then sh, then bash. ;) (yep not so reliable) So do we stick done only shell type. Its up to you.

vilijanac
welcome to shbcf.ru