Subject: Re: determining originating IP address of current rsh session
To: Laine Stump <lainestump@rcn.com>
From: Simon Burge <simonb@NetBSD.ORG>
List: netbsd-users
Date: 03/19/2000 13:53:25
Laine Stump wrote:

> At 12:06 PM 3/19/00 +1100, Simon Burge wrote:
> >	balrog:~ 2742> rsh wincen fstat -p '$$'
> >	USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W
> >	simonb   tcsh        5209   wd /home      4096 drwxr-xr-x    3584 r 
> >	simonb   tcsh        5209   16* internet stream tcp c05a16e0
> 172.73.42.244:514 <-> 172.73.42.42:1011
> >	simonb   tcsh        5209   17* internet stream tcp c05a16e0
> 172.73.42.244:514 <-> 172.73.42.42:1011
> >	simonb   tcsh        5209   18* unix stream c060f2c0 <-> c060f3c0
> >	simonb   tcsh        5209   19* internet stream tcp c05a16e0
> 172.73.42.244:514 <-> 172.73.42.42:1011
> >
> >In this case I'm rsh'ing from 172.73.42.42 to 172.73.42.244.  You
> >could then use some awk to grab the relevent fields.
> 
> That definitely contains the info I need. Interestingly, when I do that
> command into an account that uses bash as its shell, the "CMD" field says
> "fstat" instead of "bash".

I'd guess it's something to do with bash's quoting of '$$'.  As long
as you get the IP address you want, don't worry :-)

Simon.