Login shell?

Thomas Hameenaho thomas at uplog.se
Thu Nov 10 18:33:02 AEST 1988


In article <1829 at ogccse.ogc.edu> schaefer at ogccse.UUCP (Barton E. Schaefer) writes:
>I have no experience with SysV, so somebody else will have to tell
>me if this does not work there.  But on BSD, why not:
>    1) Use "ps xl" (produces the PARENT pid as well as the pid)
>    2) Grep for the pid
>    3) Check the parent pid; if `1', then you have a login shell
>

This is not completely fool-proof either. If you have shell that isn't the
login shell and you manage to kill the parent of this shell without killing
the shell itself this shell winds up having a PPID of 1.

-- 
Real life:	Thomas Hameenaho		Email:	thomas at uplog.{se,uucp}
Snail mail:	TeleLOGIC Uppsala AB		Phone:	+46 18 189406
		Box 1218			Fax:	+46 18 132039
		S - 751 42 Uppsala, Sweden



More information about the Comp.unix.questions mailing list