[UCLA-LUG] help please

dannys@csua.ucla.edu dannys@csua.ucla.edu
Wed, 2 Feb 2000 09:49:34 -0800


Tigran <tigran@usanogh.com> wrote:
>Is there a command to find out the ip address of a user who is telneting 
>into the server and then set a variable to that ip so that it can be used 
>for other stuff later.

If you're allowed to modify the .login/.profile whatever files...  you
can try something like:

MYIP=`last | `whoami` | head -1 | awk ' { print $3 }'`

Except that last uses the domain name, when available, and will
truncate it...  There may be a command line option to make it not
truncate.  'w' may also be used for the same effect.