<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to configure $REMOTEHOST env variable ? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199329#M324499</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;By default my HP UX m/c doesn't configure $REMOTEHOST variable. How can I configure REMOTEHOST variable ? Pls help me.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ramesh&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 16 May 2008 10:26:05 GMT</pubDate>
    <dc:creator>J Ramesh Kumar</dc:creator>
    <dc:date>2008-05-16T10:26:05Z</dc:date>
    <item>
      <title>How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199329#M324499</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;By default my HP UX m/c doesn't configure $REMOTEHOST variable. How can I configure REMOTEHOST variable ? Pls help me.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ramesh&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 16 May 2008 10:26:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199329#M324499</guid>
      <dc:creator>J Ramesh Kumar</dc:creator>
      <dc:date>2008-05-16T10:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199330#M324500</link>
      <description>I'm afraid we need more details of what you are trying to accomplish and what you expect this variable to contain before we can be of much help.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 16 May 2008 10:35:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199330#M324500</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2008-05-16T10:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199331#M324501</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;Pete is right! Unless, you know what this variable meaning is, you cannot define it.&lt;BR /&gt;&lt;BR /&gt;If you want to explicitly define this variable, you must execute the following commands:&lt;BR /&gt;REMOTEHOST=&lt;VALUE&gt;&lt;BR /&gt;export REMOTEHOST&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You may also wish to include this in your .profile or /etc/profile&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hope this helps!&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj&lt;/VALUE&gt;</description>
      <pubDate>Fri, 16 May 2008 10:42:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199331#M324501</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2008-05-16T10:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199332#M324502</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Sorry for insufficient information. &lt;BR /&gt;&lt;BR /&gt;By default, the $REMOTEHOST env variable is set in the linux env. The $REMOTEHOST variable has the name of the remote host which connected to a linux m/c. &lt;BR /&gt;&lt;BR /&gt;I am trying to get name of the remote m/c which connected to a hpux m/c.This will help to monitor the remote host activities. Hope this clear.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ramesh</description>
      <pubDate>Fri, 16 May 2008 10:56:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199332#M324502</guid>
      <dc:creator>J Ramesh Kumar</dc:creator>
      <dc:date>2008-05-16T10:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199333#M324503</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Sorry for the insufficient information. &lt;BR /&gt;&lt;BR /&gt;By default, the $REMOTEHOST env variable is set in the linux env. The $REMOTEHOST variable has the name of the remote host which connected to a linux m/c. &lt;BR /&gt;&lt;BR /&gt;I am trying to get name of the remote m/c which connected to a hpux m/c.This will help to monitor the remote host activities. Hope this clear.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ramesh</description>
      <pubDate>Fri, 16 May 2008 10:56:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199333#M324503</guid>
      <dc:creator>J Ramesh Kumar</dc:creator>
      <dc:date>2008-05-16T10:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199334#M324504</link>
      <description>&amp;gt;I am trying to get name of the remote m/c which connected to a hpux m/c.&lt;BR /&gt;&lt;BR /&gt;Something like:&lt;BR /&gt;who -a | awk -v user=$LOGNAME '$0 ~ user {print $NF}'</description>
      <pubDate>Fri, 16 May 2008 11:07:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199334#M324504</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-05-16T11:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199335#M324505</link>
      <description>Hi Ramesh:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis: who -a | awk -v user=$LOGNAME '$0 ~ user {print $NF}'&lt;BR /&gt;&lt;BR /&gt;I think Dennis meant 'who -u' as:&lt;BR /&gt;&lt;BR /&gt;# who -u | awk -v user=$LOGNAME '$0 ~ user {print $NF}'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 16 May 2008 11:13:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199335#M324505</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-05-16T11:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199336#M324506</link>
      <description>Hi Dennis / JRF,&lt;BR /&gt;&lt;BR /&gt;Thanks for the response. The following command gives all the m/c names which are currently connected.&lt;BR /&gt;&lt;BR /&gt;who -u | awk -v user=$LOGNAME '$0 ~ user {print $NF}'&lt;BR /&gt;&lt;BR /&gt;But I require the remote m/c name of the current terminal/telnet. I do not require all the remote host names. I am currently working on monitoring of user activities. Please refer the following thread for complete details about the functionality. And also please search REMOTEHOST string in the attachment of that thread. I need to set the exact m/c name into that variable.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1232079" target="_blank"&gt;http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1232079&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ramesh</description>
      <pubDate>Fri, 16 May 2008 11:29:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199336#M324506</guid>
      <dc:creator>J Ramesh Kumar</dc:creator>
      <dc:date>2008-05-16T11:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199337#M324507</link>
      <description>&amp;gt;The following command gives all the m/c names which are currently connected.&lt;BR /&gt;&lt;BR /&gt;Yes, for that user.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;But I require the remote m/c name of the current terminal/telnet.&lt;BR /&gt;&lt;BR /&gt;Ok, you can use this script:&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;# Find source machine from tty(1)&lt;BR /&gt;TTY=$(tty) # issue with pipes&lt;BR /&gt;who -u | awk -v tty=$TTY '&lt;BR /&gt;BEGIN { tty = substr(tty, 6) } # strip /dev/&lt;BR /&gt;$0 ~ tty {print $NF}'</description>
      <pubDate>Sat, 17 May 2008 05:11:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199337#M324507</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-05-17T05:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199338#M324508</link>
      <description>Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;The script does not give any output. I have saved the script commands in a file named a.sh and I executed it by "$sh a.sh". It does not print anything in the console. Am I miss anything ?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ramesh</description>
      <pubDate>Sat, 17 May 2008 05:25:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199338#M324508</guid>
      <dc:creator>J Ramesh Kumar</dc:creator>
      <dc:date>2008-05-17T05:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199339#M324509</link>
      <description>Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;For your quick reference, my console output of "who -u" command is,&lt;BR /&gt;&lt;BR /&gt;bash-3.00$ who -u&lt;BR /&gt;test       pts/ta       May  1 18:15   .    15226  MEPS1.india.adventnet.com&lt;BR /&gt;test       pts/tb       May 16 15:16 21:10  22735  rameshj.india.adventnet.com&lt;BR /&gt;test       pts/tc       May 17 11:36  0:04  12941  rameshj.india.adventnet.com&lt;BR /&gt;test       pts/td       May 15 15:06  0:09  23817  opman-sigma1.india.adventnet.com&lt;BR /&gt;guest      pts/0        May 17 10:41  old   11028  assetmgmt-test1.india.adventnet.com&lt;BR /&gt;test       pts/te       May 17 12:23   .    14597  rameshj.india.adventnet.com&lt;BR /&gt;test       pts/tf       May 16 16:35 19:53  26126  rameshj.india.adventnet.com&lt;BR /&gt;guest      pts/1        Apr 29 01:41  old   20391  console-server.india.adventnet.com&lt;BR /&gt;guest      pts/2        Apr 29 01:41  old   20402  console-server.india.adventnet.com&lt;BR /&gt;&lt;BR /&gt;My HPUX version is, B.11.11&lt;BR /&gt;&lt;BR /&gt;This may help you to identify the issue.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ramesh</description>
      <pubDate>Sat, 17 May 2008 06:15:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199339#M324509</guid>
      <dc:creator>J Ramesh Kumar</dc:creator>
      <dc:date>2008-05-17T06:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199340#M324510</link>
      <description>&amp;gt;The script does not give any output.&lt;BR /&gt;&lt;BR /&gt;It worked fine for me, after a lot of tweaking. :-)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I executed it by "$sh a.sh". It does not print anything in the console. Am I miss anything?&lt;BR /&gt;&lt;BR /&gt;That should be it.  But you could make it executable so you don't need to use "sh".&lt;BR /&gt;&lt;BR /&gt;Add this echo here:&lt;BR /&gt;TTY=$(tty) # issue with pipes&lt;BR /&gt;echo "TTY is: $TTY"</description>
      <pubDate>Sat, 17 May 2008 06:15:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199340#M324510</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-05-17T06:15:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199341#M324511</link>
      <description>Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;After adding the echo the script output is,&lt;BR /&gt;&lt;BR /&gt;bash-3.00$ ./a.sh&lt;BR /&gt;TTY is: /dev/ttyp6&lt;BR /&gt;bash-3.00$&lt;BR /&gt;&lt;BR /&gt;I could not find any information related to tty in the who -u command output. This may be configuration issue. But I am sure.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ramesh</description>
      <pubDate>Sat, 17 May 2008 06:22:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199341#M324511</guid>
      <dc:creator>J Ramesh Kumar</dc:creator>
      <dc:date>2008-05-17T06:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199342#M324512</link>
      <description>&amp;gt;For your quick reference, my console output of "who -u" command is,&lt;BR /&gt;&lt;BR /&gt;Thanks.  I don't see your tty there.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I could not find any information related to tty in the who -u command output.&lt;BR /&gt;&lt;BR /&gt;It talks about "line".  There is also mention about using -R with -u but I don't see much difference.&lt;BR /&gt;&lt;BR /&gt;What do you get for: pty&lt;BR /&gt;And: ll -i /dev/ttyp6</description>
      <pubDate>Sat, 17 May 2008 07:18:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199342#M324512</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-05-17T07:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199343#M324513</link>
      <description>Hi Dennis,&lt;BR /&gt;&lt;BR /&gt;Following are the output of the required commands,&lt;BR /&gt;&lt;BR /&gt;bash-3.00$ pty&lt;BR /&gt;/dev/ttyp6&lt;BR /&gt;bash-3.00$ ll -i /dev/ttyp6&lt;BR /&gt;   822 crw--w----   2 test       tty         17 0x000006 May 17 14:55 /dev/ttyp6&lt;BR /&gt;bash-3.00$&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ramesh</description>
      <pubDate>Sat, 17 May 2008 08:38:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199343#M324513</guid>
      <dc:creator>J Ramesh Kumar</dc:creator>
      <dc:date>2008-05-17T08:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199344#M324514</link>
      <description>&amp;gt;Following are the output of the required commands&lt;BR /&gt;&amp;gt;$ ll -i /dev/ttyp6&lt;BR /&gt;822 crw--w---- 2 test tty 17 0x000006 May 17 14:55 /dev/ttyp6&lt;BR /&gt;&lt;BR /&gt;Perhaps there are two names for this tty?  How about:&lt;BR /&gt;$ find /dev -inum 822&lt;BR /&gt;&lt;BR /&gt;(On my system the basenames of the files match.)&lt;BR /&gt;</description>
      <pubDate>Sat, 17 May 2008 08:54:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199344#M324514</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-05-17T08:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199345#M324515</link>
      <description>Following are the output of find command,&lt;BR /&gt;&lt;BR /&gt;#  find /dev -inum 822&lt;BR /&gt;/dev/pty/ttyp6&lt;BR /&gt;/dev/ttyp6&lt;BR /&gt;#</description>
      <pubDate>Sat, 17 May 2008 08:58:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199345#M324515</guid>
      <dc:creator>J Ramesh Kumar</dc:creator>
      <dc:date>2008-05-17T08:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199346#M324516</link>
      <description>&amp;gt;Following are the output of find command,&lt;BR /&gt;&amp;gt;/dev/pty/ttyp6 /dev/ttyp6&lt;BR /&gt;&lt;BR /&gt;Hmm, I'm not sure how to map these BSD pseudo terminals to your Streams pseudo-terminals.&lt;BR /&gt;Looking at pts(7) ptm(7) pty(7) doesn't mention it.&lt;BR /&gt;&lt;BR /&gt;You might be able to map the time stamp on ttyp6 with one in the /dev/pts/ directory???</description>
      <pubDate>Sat, 17 May 2008 09:32:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199346#M324516</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-05-17T09:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199347#M324517</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;If the script suggested by you is working fine for most of the HP UX system, I may go with that script. In case of any issue in finding remote host(like my local HP UX m/c), my application log will be reported as "Unknown Host". But I would like convert your script into 2 lines and assign the host name into a variable named REMOTEHOST. Is the following 2 lines working fine in ur m/c ? ie, the REMOTEHOST variable is properly assigned with actual value. This will help me integrate the same.&lt;BR /&gt;&lt;BR /&gt;TTY=$(tty) # issue with pipes&lt;BR /&gt;REMOTEHOST=`who -u | awk -v tty=$TTY 'BEGIN { tty = substr(tty, 6) } $0 ~ tty {print $NF}'`&lt;BR /&gt;&lt;BR /&gt;Since the issue in my m/c may be due to configuration issue, we will try to identify the issue in parallel.&lt;BR /&gt;&lt;BR /&gt;I really appreciate your great support and effort on resolving the issue. Thank you very much.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ramesh</description>
      <pubDate>Sat, 17 May 2008 09:58:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199347#M324517</guid>
      <dc:creator>J Ramesh Kumar</dc:creator>
      <dc:date>2008-05-17T09:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure $REMOTEHOST env variable ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199348#M324518</link>
      <description>&lt;!--!*#--&gt;&amp;gt;Is the following 2 lines working fine in your m/c? ie, the REMOTEHOST variable is properly assigned with actual value.&lt;BR /&gt;&lt;BR /&gt;Yes.  But you shouldn't use the obsolete ``.&lt;BR /&gt;Use this one liner:&lt;BR /&gt;REMOTEHOST=$(TTY=$(tty); who -u | awk -v tty=$TTY 'BEGIN { tty = substr(tty, 6) } $0 ~ tty {print $NF}')&lt;BR /&gt;&lt;BR /&gt;Note you don't really need to put this all on one line.  You can do:&lt;BR /&gt;REMOTEHOST=$(TTY=$(tty)&lt;BR /&gt;   who -u |&lt;BR /&gt;   awk -v tty=$TTY '&lt;BR /&gt;BEGIN { tty = substr(tty, 6) }&lt;BR /&gt;$0 ~ tty {print $NF}')</description>
      <pubDate>Sat, 17 May 2008 10:24:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-configure-remotehost-env-variable/m-p/4199348#M324518</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-05-17T10:24:02Z</dc:date>
    </item>
  </channel>
</rss>

