Kamaraju S Kusumanchi elucubrated on 2011-05-05:
Inside a konsole running bash shell, If I do

$       # initial konsole prompt
$ bash  # spawn a new shell
$ bash  # spawn third shell
$ bash  # spawn fourth shell

Now is there any command which tells that the current shell's "depth" is 4
as in it has three "parent shells"?


There might be a more direct way, but pstree will show you something
like this:

$
$ bash
$ bash
$ bash
$ pstree

<snip>
     ├─urxvtd─┬─bash───bash───bash───bash───pstree
</snip>

In other words, look for the line containing "pstree" in the output of
the command pstree and count the number of bash, this will give you the
depth.

--
EHD

_______________________________________________
D-community-offtopic mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic

Reply via email to