From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Hutcheson, Mike" Newsgroups: gmane.os.tru64.managers Subject: Summary: Getting client IP address from shell Date: Fri, 31 Jan 2003 13:50:34 -0600 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: main.gmane.org 1044042547 29464 80.91.224.249 (31 Jan 2003 19:49:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 31 Jan 2003 19:49:07 +0000 (UTC) Return-path: Original-Received: from sws1.ctd.ornl.gov ([160.91.22.101]) by main.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 18eh9t-0007f2-00 for ; Fri, 31 Jan 2003 20:49:06 +0100 Original-Received: (qmail 16411 invoked by uid 5); 31 Jan 2003 19:50:46 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 16402 invoked by uid 49493); 31 Jan 2003 19:50:45 -0000 Original-Received: from Mike_Hutcheson@baylor.edu by sws1 by uid 49491 with qmail-scanner-1.14 (clamscan: 0.54. spamassassin: 2.50-cvs. Clear:SA:0(-1.6/5.0):. Processed in 0.424249 secs); 31 Jan 2003 19:50:45 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (160.91.4.119) by 0 with SMTP; 31 Jan 2003 19:50:45 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.1-1 #30669) with ESMTP id <0H9L002JLGGDR2@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 31 Jan 2003 14:50:44 -0500 (EST) Original-Received: from FS-EXCHANGE1.baylor.edu (flopsy.baylor.edu [129.62.3.249]) by emroute1.cind.ornl.gov (PMDF V6.1-1 #30669) with ESMTP id <0H9L00J4FGGBEX@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Fri, 31 Jan 2003 14:50:35 -0500 (EST) Original-To: tru64-unix-managers@ornl.gov X-MIMEOLE: Produced By Microsoft Exchange V6.0.5762.3 Thread-Topic: Summary: Getting client IP address from shell Thread-Index: AcLJYgT4Hj3erM2NREieuxaHiiYuGQ== content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: Xref: main.gmane.org gmane.os.tru64.managers:3175 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:3175 Fantastic! I received several very helpful responses to my question = about getting the client IP address from the shell during a telnet or = ssh session. The list of respondents is long so to keep things short = I'll just say thanks to everyone who replied. The simplest solution that I received from several people was to use the = who -m command and pipe it through awk and sed. #!/bin/sh client_addr=3D`who -m | awk '{ printf $NF }' | sed 's/[()]//g'` Thanks again! Mike Hutcheson (Mike_Hutcheson@baylor.edu) Systems Manager (254) 710-4110 Baylor University - Information Technology Services