Thanks!! But I want something akin to the value of $REMOTEHOST under tcsh. This can be generalized under unix by doing
who am i | sed 's/.*(\(.*\))$/\1/' # as was suggested by one the member..thanks to him!! but will not work under non Unix envi. Here comes in the perl. I was hoping for something which is shell/platform independent. Can it be done ?? -----Original Message----- From: drieux [mailto:[EMAIL PROTECTED]] Sent: Friday, June 07, 2002 2:18 PM To: perl beginners Subject: Re: IP address On Friday, June 7, 2002, at 09:41 , Shishir K. Singh wrote: > I have a requirement to get the IP address of a user logged from a remote > machine on to UNIX machine. Now the user can be using multiple logins > through VPN or otherwise. I need to create something akin to command > "finger" which will return the user his IP address based on his current > session. > > Can someone point me in the right direction of how to do it?? well there are some problems that you will have here - since basically you seemt to want to track 'back' to the source (??) I will presume that you already have looked an 'man who' and hence can get information like: vladimir: 57:] who war pts/0 May 24 13:46 (oozer) drieux pts/1 Jun 7 10:54 (wetware) drieux pts/2 Jun 7 10:55 (jeeves) drieux pts/3 Jun 7 10:57 (gax) vladimir: 58:] which shows that I logged into vladimir from wetware - but it of course does not show that I arrived there from jeeves... so what you want is a WhoBe.pl that would gin up say: vladimir: 56:] perl whoBe.pl player drieux is in from: wetware jeeves gax player war is in from: oozer vladimir: 57:] http://www.wetware.com/drieux/pbl/Sys/Admin/whoParser.txt You will of course note, that this will work on solaris and linux and darwin, and will pick up only the 'remote users' - not anyone with a direct login on the box itself - as is the case for folks using those OS's for their desk top. Now you also have the issue that if your DNS is set up so that it can 'resolve' the name - then you will get the name from DNS and not the IP_ADDR - in the case that there is no way to reverse from the IP_ADDR to a name, then you will get a dotQuad. ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]