Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: overkill (was Re: How can a login script determine if the session is remotely logged in?) Keywords: rlogin, script Message-ID: <2291@auspex.auspex.com> Date: 26 Jul 89 00:41:21 GMT References: <1448@tellab5.tellabs.CHI.IL.US> <1989Jul22.222552.11416@ctr.columbia.edu> <4689@omepd.UUCP> Reply-To: guy@auspex.auspex.com (Guy Harris) Distribution: usa Organization: Auspex Systems, Santa Clara Lines: 29 >Sure you can. If you get a TERM type, you're rlogin, if not, itza >telnet. Sorry, wrong answer; the 4.3BSD version of "telnet" uses (or abuses - it doesn't follow the protocol, but I'll let those who care one way or the other argue the point) the "terminal type" option to "telnet" to set TERM on the remote machine. Said version is the basis of the one in 4.x; I don't know if it's in 3.x or not. (Not that it matters, since they probably want the label for either one....) >case "$TERM" in >sun) > case `tty` in > *ttyp*) > /usr/5bin/echo "\\033]lRLOGIN:`hostname`\\033\\\\";; > esac;; >esac Well, two problems with that: 1) pseudo-ttys *do* have names that don't contain "ttyp", like "ttyq0", "ttyq1", "ttyq1", etc. 2) TERM is "sun-cmd", not "sun", in a "cmdtool" window. Both fixable, of course, with different patterns in the "case" construct.