REMOTEHOST
Kai Ng
ng at cfd.di.nrc.ca
Sat Mar 23 06:15:54 AEST 1991
In article <6050 at awdprime.UUCP>, crow at waterloo.austin.ibm.com (David L. Crow) writes:
|> >In AIX/RS6000, is there a way to find out from where you are actually
|> >login'ed ?
|>
|> # The first statement sets the TTY variable to be what is returned from
|> # the 'tty' command without the /dev/ ie if tty returned '/dev/pty/3',
|> # then all we want is 'pty/3'
|> # The second statement determines the display name for X to use. I use
|> # who to determine which machine we are coming from. We grep on the tty
|> # found in the previous step. The awk gets the last item on the line
|> # (i.e. the hostname). The last item is of the form (host.domain...). The
|> # sed will strip the parenthesis and the domain leaving only the hostname.
|> # Then we append the ":0" to make it the display name.
|>
|> TTY=$(tty | sed 's/\/dev\///')
|> DISPLAY=$(who | grep $TTY | awk '{print $NF}' | sed
|> 's/(\([a-zA-Z0-9_]*\).*/\1/'):0
|> export TTY DISPLAY
|>
|> - This is only an exhibition, not a competition, so please....no wagering. -
|> David Crow (512) 823-4834 IBM VNET: dlcrow at austin
|> AIX Systems Graphics Development Internet: crow at waterloo.austin.ibm.com
|> ------ Any opinions expressed are those of me and not of my employer. ------
This little script should works perfect and could be a perfect solution to me.
However, owing to the BUG in 'who' (which lists users who have already
logoff'ed and so in the list there are entries with same tty number), it
fails consistently. :-(
Is this bug fixed in 3003? We've just got the update tape and have not
applied it yet.
Thanks for the solution.
--
-----------------------------------------------------------------------------
Kai S. Ng Informatics, National Research Council Canada
INTERNET ng at cfd.di.nrc.ca M-60 Montreal Road, Ottawa, Canada K1A 0R6
BITNET kain at nrcvm01.bitnet VOICE (613) 993-0240 FAX (613) 954-2561
More information about the Comp.unix.aix
mailing list