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

Joe Digilio jdigilio at earth.northwestern.edu
Fri Jun 13 18:41:54 CDT 2003


Yeah, it breaks plain-old "ps". But, "ps T" will (quoting from the manual) 
"select all processes on this terminal".  So it will indeed show all 
processes in this xterm (including su spawned shells).

I notice in your example you were just using ps. Try it with the "T" 
option. It's a very cool one I never knew about before.

Cheers!

Joe


On Fri, 13 Jun 2003, Martin Maney wrote:

> On Fri, Jun 13, 2003 at 04:43:46PM -0500, Joe Digilio wrote:
> > 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
> 
> Alas, su-with-a-dash breaks this just as it does $SHLVL:
> 
> $ ps
>   PID TTY          TIME CMD
>  1107 pts/1    00:00:00 bash
>  7859 pts/1    00:00:00 ps
> $ su -
> Password: 
> # ps
>   PID TTY          TIME CMD
>  7860 pts/1    00:00:00 bash
>  7862 pts/1    00:00:00 ps
> 
> Once again, the root problem is all those stacked su invocations that
> confuse... well, most everyone and everything.  :-)
> 
> 

-- 
.........................................................  
 Joe Digilio             jdigilio at earth.northwestern.edu         
 Northwestern University - Center for Planetary Sciences
 1850 Campus Dr, Locy Hall 309, Evanston, IL  60208-2150
 Phone: 847.491.3459                   Fax: 847.491.8060
.........................................................



More information about the luni mailing list