Finding your remote host's name

Kartik Subbarao subbarao at phoenix.Princeton.EDU
Fri Jun 8 04:21:12 AEST 1990


In article <1211 at tuewsd.win.tue.nl> wswietse at lso.win.tue.nl (Wietse Venema) writes:
>scm at 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 at silvertone.Princeton.EDU (NeXT mail)       -|	
subbarao at pucc.Princeton.EDU		          - Bitnet



More information about the Comp.unix.questions mailing list