Login shell?

Thomas Hameenaho thomas at uplog.se
Mon Oct 17 22:59:49 AEST 1988


One way of deciding wether or not the current shell is the login shell
is the fact that the name of the login shell is prependended with a '-'.
If for instance I run tcsh as my login shell it will be exec:ed with
-tcsh as argv[0].

Just take the output from ps -x (or -f if on system V) grep for pid $$
and check if the command name begins with a '-'. If that is the case the
shell is the login shell.

-- 
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