[LUNI] Remembering which shell (not a good explaination)

Joe Digilio jdigilio at earth.northwestern.edu
Fri Jun 13 16:43:46 CDT 2003


Well, I got intrigued by this question. After a bit of playing around, the 
best way I've come up with so far to tell how deep you are is this:

   ps --no-headers To cmd | grep "^-\w*sh" | wc -l

That *should* tell you how many levels deep you are (1 being the top 
level).  You could use this to modify your prompt at each login, or maybe 
make an alias that you could manually run before exiting.

That's the best I can come up with so far.
Hope that helps...

Joe


> On Fri, Jun 13, 2003 at 07:47:49AM -0500, Jay Strauss wrote:
> > Xterm.  I always su-ing and I get a few shells deep.  Then at some point I
> > start exiting (trying to get back to my original).  Many times I'll exit one
> > too many times and my window will close.
> > 
> > Anyone have a good idea how I could tell that I'm back to my original xterm
> > shell (that was lanched from an ssh shell)?



More information about the luni mailing list