From: Greg Russell on 3 May 2010 15:21 In news:slrnhtu5ut.j5v.unruh(a)wormhole.physics.ubc.ca, unruh <unruh(a)wormhole.physics.ubc.ca> typed: .... > Nope. does not work at all. > > info:0.0[unruh]>env|grep SHL > SHLVL=5 > info:0.0[unruh]>ssh info > Last login: Mon May 3 00:23:12 2010 from xxxxxxxxxxxx > info:11.0[unruh]>env|grep SHL > SHLVL=1 It's working perfectly, since your ssh connection is the first level of shell iteration for that login, independent of any other login sessions that you might have on that machine.
From: unruh on 3 May 2010 16:40 On 2010-05-03, Greg Russell <grussell(a)example.con> wrote: > In news:slrnhtu5ut.j5v.unruh(a)wormhole.physics.ubc.ca, > unruh <unruh(a)wormhole.physics.ubc.ca> typed: > > ... >> Nope. does not work at all. >> >> info:0.0[unruh]>env|grep SHL >> SHLVL=5 >> info:0.0[unruh]>ssh info >> Last login: Mon May 3 00:23:12 2010 from xxxxxxxxxxxx >> info:11.0[unruh]>env|grep SHL >> SHLVL=1 > > It's working perfectly, since your ssh connection is the first level of > shell iteration for that login, independent of any other login sessions that > you might have on that machine. It may be doing what it is supposed to do, but that is not what I needed. a) An Konsole terminal on a X desktop indicated level 5, when it was actually the first level in that window. Not what I want, even though I know why it is doing that. b) when I open another ssh into the same machine it was showing level 1 when what I needed was to know that this was an ssh into the same work computer I was on. (Since I log on from home as much as from work, when I do something I tend to automatically do ssh info, to get into the work machine, even if I am at work. That of course is now a level deeper.) > >
From: Greg Russell on 3 May 2010 20:20 In news:slrnhtud5s.v4o.unruh(a)wormhole.physics.ubc.ca, unruh <unruh(a)wormhole.physics.ubc.ca> typed: >>> info:0.0[unruh]>ssh info >>> Last login: Mon May 3 00:23:12 2010 from xxxxxxxxxxxx >>> info:11.0[unruh]>env|grep SHL >>> SHLVL=1 >> >> It's working perfectly, since your ssh connection is the first level >> of shell iteration for that login, independent of any other login >> sessions that you might have on that machine. > > It may be doing what it is supposed to do, but that is not what I > needed. a) An Konsole terminal on a X desktop indicated level 5, when > it was actually the first level in that window. Not what I want, ... It was the 5th bash shell started in that login session, so what you "want" is the thing that's broken.
From: Bill Marcum on 4 May 2010 12:45 On 2010-05-03, unruh <unruh(a)wormhole.physics.ubc.ca> wrote: > > It may be doing what it is supposed to do, but that is not what I > needed. a) An Konsole terminal on a X desktop indicated level 5, when it > was actually the first level in that window. Not what I want, even > though I know why it is doing that. b) when I open another ssh into the > same machine it was showing level 1 when what I needed was to know that > this was an ssh into the same work computer I was on. (Since I log on > from home as much as from work, when I do something I tend to > automatically do ssh info, to get into the work machine, even if I am at > work. That of course is now a level deeper.) > If what you want to know is whether you have other shells logged into the same machine, you might try parsing the output of ps or w.
From: John Thompson on 4 May 2010 21:51
On 2010-05-03, Bit Twister <BitTwister(a)mouse-potato.com> wrote: > On Mon, 03 May 2010 07:01:56 -0400, David Bernier wrote: > >> The following works when iterating "/bin/bash/" : >> >> [david(a)localhost ~]$ env|grep SHLVL > So does > echo "LEVEL=$SHLVL" Ok, so now how do you get that into your PROMPT string? -- -John (john(a)os2.dhs.org) |