From: Harald Meyer on 8 Apr 2010 19:28 unruh wrote: > When I do > exit Control-d sends an EOT End-Of-Text character, less typing. > I can often discover myself buried 5 or 6 layers deep (ie I have to hit > exit 5 or 6 times to finally close the window). How do you manage to stack so many shells??? > Is there any easy way I can find out how deeply I am buried In bash: echo $SHLVL
From: unruh on 8 Apr 2010 20:42 On 2010-04-08, Bit Twister <BitTwister(a)mouse-potato.com> wrote: > On Thu, 08 Apr 2010 21:30:54 GMT, unruh wrote: >> >> I can often discover myself buried 5 or 6 layers deep (ie I have to hit >> exit 5 or 6 times to finally close the window). >> >> Is there any easy way I can find out how deeply I am buried so I can >> close all but the last one? > > Yes. > > click up a terminal > > env | sort > x1 > bash > env | sort > x2 > exit > diff -bBw x1 x2 > > Maybe a shell level variable will show up. > I am using ssh to connect to the computer, not just opening another bash. However your suggestions shows that I get a change in the DISPLAY variable if I do what I do. (base is 0.0, then 10.0, 11.0,...) Unfortunately if I open one level deep on terminal 1 I get echo $DISPLAY localhost:10.0 while on another widown, I do the same, I now get echo $DISPLAY localhost:11.0 Ie, it does not count up separately on each terminal. But I guess getting something other than 0.0 tells me that I have dug in at least one level deep on that terminal. Thanks.
From: unruh on 8 Apr 2010 20:45 On 2010-04-08, Harald Meyer <meyersharald(a)googlemail.com> wrote: > unruh wrote: > >> When I do >> exit > > Control-d sends an EOT End-Of-Text character, less typing. > >> I can often discover myself buried 5 or 6 layers deep (ie I have to hit >> exit 5 or 6 times to finally close the window). > > How do you manage to stack so many shells??? Bad habits. When I want to for example look at mail, I tend to do ssh workmachine and when I come out of pine, I just continue working on that terminal without exiting, until I next want to look at mail. After a few days, I can be pretty deep. > >> Is there any easy way I can find out how deeply I am buried > > In bash: echo $SHLVL No, that just tells how many "bash" you have run in that terminal, but each ssh starts again at 0 (or in one case at 5, even though I was down at base level)
From: Harald Meyer on 8 Apr 2010 21:12 unruh wrote: > When I want to for example look at mail, I tend to do > ssh workmachine > and when I come out of pine, I just continue working on that terminal > without exiting, until I next want to look at mail. If I got that right, you are already on workmachine, but think you're on homebox and connect from workmachine to workmachine again. Why don't you include the hostname in the prompt?
From: Bit Twister on 8 Apr 2010 22:33
On Fri, 09 Apr 2010 00:42:16 GMT, unruh wrote: > > I am using ssh to connect to the computer, not just opening another > bash. However your suggestions shows that I get a change in the DISPLAY > variable if I do what I do. (base is 0.0, then 10.0, 11.0,...) > Unfortunately if I open one level deep on terminal 1 I get > echo $DISPLAY > localhost:10.0 > while on another widown, I do the same, I now get > echo $DISPLAY > localhost:11.0 > Ie, it does not count up separately on each terminal. But I guess > getting something other than 0.0 tells me that I have dug in at least > one level deep on that terminal. Hmm, Wonder what the $DISPLAY would be if someone else ssh'ed into the system before you logged in. :) You might want to consider a file in your account where login bumps a counter and your logout script decrements the counter. Another method would be to use ps,grep/pgrep to decide how many open sessions you have running. |