Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!aplcen!haven!udel!princeton!phoenix!subbarao From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao) Newsgroups: comp.unix.questions Subject: Re: Finding your remote host's name Message-ID: <17060@phoenix.Princeton.EDU> Date: 7 Jun 90 18:21:12 GMT References: <1990Jun6.091842.11335@dlcq15.datlog.co.uk> <1211@tuewsd.win.tue.nl> Reply-To: subbarao@phoenix.Princeton.EDU (Kartik Subbarao) Lines: 23 In article <1211@tuewsd.win.tue.nl> wswietse@lso.win.tue.nl (Wietse Venema) writes: >scm@dlcq15.datlog.co.uk (Steve Mawer) writes: > >>If I `rlogin' from machine1 to machine2, is there a simple and (relatively) >>portable way to find out on machine2 the name of machine1? I'd like to do >>this from a shell script if possible, but I'm willing to write C code if >>necessary. > >/* fromhost - print name of host we are logged in from */ < Extensive C code deleted > YOW! I don't see at all why it has to be that complicated. We can just do this: set from = `who am i | cut -d'(' -f2 | cut -d')' -f1` and do with $from as we wish. -- subbarao@{phoenix,bogey or gauguin}.Princeton.EDU -|Internet kartik@silvertone.Princeton.EDU (NeXT mail) -| subbarao@pucc.Princeton.EDU - Bitnet