Finding your remote host's name

Ed Anselmo Anselmo-Ed at cs.yale.edu
Fri Jun 8 06:40:48 AEST 1990


>>>>> On 7 Jun 90 18:21:12 GMT, subbarao at phoenix.Princeton.EDU (Kartik Subbarao) said:

Kartik> YOW! I don't see at all why it has to be that complicated. We can just
Kartik> do this:

Kartik> set from = `who am i | cut -d'(' -f2 | cut -d')' -f1`

Kartik> and do with $from as we wish.

This certainly doesn't work with all versions of "who" (I just tried
it on a Sun, a Xenix machine, an ATT unix/386 machine, something
running mach, and an apollo).  Some versions of "who am i" show the
machine name, some don't.  Even on the ones that do show the machine
name, the name is typically trucated to 16 or so characters, e.g
"bigbird.cf.cs.ya" instead of "bigbird.cf.cs.yale.edu".
--
Ed Anselmo   anselmo-ed at cs.yale.edu   {harvard,decvax}!yale!anselmo-ed



More information about the Comp.unix.questions mailing list