Login shell?
Griff Smith
ggs at ulysses.homer.nj.att.com
Tue Nov 1 10:30:30 AEST 1988
In article <25721 at bu-cs.BU.EDU>, madd at bu-cs.BU.EDU (Jim Frost) writes:
> In article <314 at uplog.se> thomas at uplog.UUCP (Thomas Hameenaho) writes:
| |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 '-'.
| ...
> That's not really a good indicator. Instead what I'd do is build the
> process tree (you can use the output from ps or, better, sps if you
> can't build it from the actual process table). Find the first entry in
> the tree for the terminal you want. This will work on any unix
> system, while the naming convention may not.
| ...
> jim frost
> madd at bu-it.bu.edu
Still not quite right. I usually use an AT&T 630 terminal on a 4.3BSD
system. The login shell for the terminal is not the same as the shell
for the current window, and each window has a separate pty connected to
it. The kludge I use also involves reading the output of ps (ugh): I
scan back through the process tree until I find a parent with a
different uid. The child of that process is almost always the login
shell. For my purposes, this also does the right thing for `su'.
I'd rather have someone support the concept of a session id so we could
avoid this sillyness.
--
Griff Smith AT&T (Bell Laboratories), Murray Hill
Phone: 1-201-582-7736
UUCP: {most AT&T sites}!ulysses!ggs
Internet: ggs at ulysses.att.com
More information about the Comp.unix.questions
mailing list