<?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 Re: Can a .profile script dynamically set TERM? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122770#M151202</link>
    <description>yes it can be done&lt;BR /&gt;&lt;BR /&gt;#find out hostname&lt;BR /&gt;host=$(who -R | &lt;BR /&gt;awk -F "(" '/pts\/ta/{print $2}'|&lt;BR /&gt;awk -F ")" '{print $1}' )&lt;BR /&gt;&lt;BR /&gt;#find ip&lt;BR /&gt;ipadd=$(nslookup $host |&lt;BR /&gt;awk '/address/ {print $2;}')&lt;BR /&gt;&lt;BR /&gt;case $ipadd in&lt;BR /&gt;192.11.22.*([0-9])) TERM=vt100;;&lt;BR /&gt;*) TERM=hp;;&lt;BR /&gt;esac&lt;BR /&gt;</description>
    <pubDate>Tue, 18 Nov 2003 19:59:47 GMT</pubDate>
    <dc:creator>curt larson_1</dc:creator>
    <dc:date>2003-11-18T19:59:47Z</dc:date>
    <item>
      <title>Can a .profile script dynamically set TERM?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122769#M151201</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Yet another question, sorry for asking so&lt;BR /&gt;many.  This is kind of related to a previous&lt;BR /&gt;topic I've raised.&lt;BR /&gt;&lt;BR /&gt;Is it possible to modify the '.profile' script to dynamically assign the TERM environment variable to a value based on the incomming address of a given TELNET.&lt;BR /&gt;&lt;BR /&gt;IE.. if the telnet came from 192.168.0.* use TERM of linux&lt;BR /&gt;&lt;BR /&gt;     if the telnet came from 192.168.1.* use&lt;BR /&gt;TERM of vt100&lt;BR /&gt;&lt;BR /&gt;Can this be done?  All info appreciated.&lt;BR /&gt;&lt;BR /&gt;-John</description>
      <pubDate>Tue, 18 Nov 2003 19:20:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122769#M151201</guid>
      <dc:creator>John O'Neill_6</dc:creator>
      <dc:date>2003-11-18T19:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can a .profile script dynamically set TERM?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122770#M151202</link>
      <description>yes it can be done&lt;BR /&gt;&lt;BR /&gt;#find out hostname&lt;BR /&gt;host=$(who -R | &lt;BR /&gt;awk -F "(" '/pts\/ta/{print $2}'|&lt;BR /&gt;awk -F ")" '{print $1}' )&lt;BR /&gt;&lt;BR /&gt;#find ip&lt;BR /&gt;ipadd=$(nslookup $host |&lt;BR /&gt;awk '/address/ {print $2;}')&lt;BR /&gt;&lt;BR /&gt;case $ipadd in&lt;BR /&gt;192.11.22.*([0-9])) TERM=vt100;;&lt;BR /&gt;*) TERM=hp;;&lt;BR /&gt;esac&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Nov 2003 19:59:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122770#M151202</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-11-18T19:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Can a .profile script dynamically set TERM?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122771#M151203</link>
      <description>AWESOME!!&lt;BR /&gt;&lt;BR /&gt;I'll give this a shot later, but that's just what I'm after!&lt;BR /&gt;&lt;BR /&gt;Thanks again, this is a great forum.&lt;BR /&gt;&lt;BR /&gt;-John O'Neill</description>
      <pubDate>Tue, 18 Nov 2003 20:10:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122771#M151203</guid>
      <dc:creator>John O'Neill_6</dc:creator>
      <dc:date>2003-11-18T20:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can a .profile script dynamically set TERM?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122772#M151204</link>
      <description>Hi Again...&lt;BR /&gt;&lt;BR /&gt;  nslookup is unable to work as the clients&lt;BR /&gt;  have IP addresses assigned by DHCP.&lt;BR /&gt;&lt;BR /&gt;  But.. I modified the script a little&lt;BR /&gt;  and it's working a treat.&lt;BR /&gt;&lt;BR /&gt;  Since their two seperate segments and &lt;BR /&gt;  two seperate IP networks.. here's what&lt;BR /&gt;  I did:&lt;BR /&gt;&lt;BR /&gt;#find out hostname&lt;BR /&gt;host=$(who -R | awk -F "(" '/pts\/ta/{print $2}'| awk -F ")" '{print $1}' )&lt;BR /&gt;&lt;BR /&gt;#check network&lt;BR /&gt;case $host in 192.168.0.*([0-9])) TERM=vt100;;*) TERM=linux;;&lt;BR /&gt;&lt;BR /&gt;This does just what I need, dynamically assigns TERM based on incomming network.&lt;BR /&gt;&lt;BR /&gt;Thankyou very much for your help, I greatly appreciate it!&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;John O'Neill&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Nov 2003 20:31:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122772#M151204</guid>
      <dc:creator>John O'Neill_6</dc:creator>
      <dc:date>2003-11-18T20:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can a .profile script dynamically set TERM?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122773#M151205</link>
      <description>Oooohhhh, not a good idea at all!! HP-UX has had an automatic terminal identifier for more than a decade: ttytype and ttytype is normally run in /etc/profile or .profile. Now it's really important to understand what TERM does. It is an environment parameter that points terminal-aware code such as the Curses library to the right set of characteristics for a specific terminal. Curses defines dozens of terminal features in the terminfo database. Unlike other flavors of Unix, there is no termcap (OK, there is a dummy /eetc/termcap but it is ignored by Curses).&lt;BR /&gt; &lt;BR /&gt;Now what about vt100? Well that is but one of a dozen different models of the DEC VT-series of terminals, virtually none of which are actually being used on Unix boxes today. Instead, terminal emulators pretend to be a vt100 or vt220 and emulate features found on those boxes. So here's how to tell if your terminal can be identified:&lt;BR /&gt; &lt;BR /&gt;ttytype -s&lt;BR /&gt; &lt;BR /&gt;You should see soemthing like this:&lt;BR /&gt; &lt;BR /&gt;TERM='70092'; export TERM;&lt;BR /&gt;LINES=24; export LINES;&lt;BR /&gt;COLUMNS=80; export COLUMNS;&lt;BR /&gt;ERASE='^H'; export ERASE;&lt;BR /&gt; &lt;BR /&gt;Now to see what Curses looks at, use untic:&lt;BR /&gt; &lt;BR /&gt;untic 70092&lt;BR /&gt;70092|70092a|70092A|70096|hp 7009x/239x series,&lt;BR /&gt;        am, xhp, da, db, mir, &lt;BR /&gt;        cols#80, lines#24, lm#0, xmc#0, nlab#8, lh#2, lw#8, &lt;BR /&gt;        cbt=\Ei, bel=^G, cr=\r, tbc=\E3, &lt;BR /&gt;        clear=\E&amp;amp;a0y0C\EJ, el=\EK, ed=\EJ$&amp;lt;1&amp;gt;, hpa=\E&amp;amp;a%p1%dC,...&lt;BR /&gt; &lt;BR /&gt;Now checkout linux:&lt;BR /&gt; &lt;BR /&gt;untic linux&lt;BR /&gt;untic: no such terminal: linux&lt;BR /&gt; &lt;BR /&gt;So setting TERM=linux guarentees big terminal compatibility issues on HP-UX. Try setting TERM=linux and then run swinstall. So do not hardcode the TERM value as you'll always run into problems. And someday thise users will change their emulator and back come all the problems.</description>
      <pubDate>Tue, 18 Nov 2003 22:47:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122773#M151205</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2003-11-18T22:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can a .profile script dynamically set TERM?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122774#M151206</link>
      <description>Hi,&lt;BR /&gt;  &lt;BR /&gt;Thanks for the info, much appreciated.&lt;BR /&gt;&lt;BR /&gt;Here's what the .profile now has:&lt;BR /&gt;&lt;BR /&gt;# Dynamic Terminal Assignment&lt;BR /&gt;host=$(who am i -R)&lt;BR /&gt;&lt;BR /&gt;#assign TERM based on network&lt;BR /&gt;case $host in&lt;BR /&gt;   192.168.0.*([0-9])) TERM=linux;;&lt;BR /&gt;   192.168.1.*([0-9])) TERM=wyse60;;&lt;BR /&gt;   ourhost) TERM=hp;;&lt;BR /&gt;esac&lt;BR /&gt;&lt;BR /&gt;This way, my LINUX users who are all thin clients on the 2nd NIC of the HP UX box get allocated a TERM of linux.&lt;BR /&gt;&lt;BR /&gt;Now, HP UX has no idea what a 'linux' Terminal is, however.. the PROGRESS 4gl does as it has its own termcap capabilities.&lt;BR /&gt;&lt;BR /&gt;For legacy reasons, our other users are still on Wyse60 (Because, our counter based terminals are still Wyse 60)&lt;BR /&gt;&lt;BR /&gt;And anyone else gets a basic HP terminal (Console etc).&lt;BR /&gt;&lt;BR /&gt;Also, EVERYONE logs into the host with the same user id, that's company policy.  The application has its own password/user security features.&lt;BR /&gt;&lt;BR /&gt;This has been tested and it works fine.&lt;BR /&gt;&lt;BR /&gt;I'll stick with this unless setting TERM to 'linux' and running SWINSTAL is guaranteed to provide me with proper Linux Terminal support.&lt;BR /&gt;&lt;BR /&gt;I'm suprised that HP UX 11i doesn't know about the LINUX terminal type, as I think this issue will come up more often, not everyone uses GUI clients (esp in banking).&lt;BR /&gt;&lt;BR /&gt;Will running SWINSTAL with a value of 'linux' as the TERM give us LINUX terminal settings in HP UX 11i?&lt;BR /&gt;&lt;BR /&gt;Thanks :)&lt;BR /&gt;&lt;BR /&gt;-John&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                       &lt;BR /&gt;</description>
      <pubDate>Wed, 19 Nov 2003 01:46:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122774#M151206</guid>
      <dc:creator>John O'Neill_6</dc:creator>
      <dc:date>2003-11-19T01:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can a .profile script dynamically set TERM?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122775#M151207</link>
      <description>No, swinstall will discover that there is no such terminal as linux (and truthfully, there is no 'terminal' called linux since linux is an operating system). Some linux distros may have a terminal emulator but unike Wyse, HP, ANSI, VT(DEC), etc, there is no industry standard for 'linux' as a defined terminal product or emulator. &lt;BR /&gt; &lt;BR /&gt;Keep in mind that SAM and swinstall look for $DISPLAY first, and if found, will attempt to start an X11 window on the host defined in $DISPLAY. X11 doesn't use TERM at all. But if $DISPLAY is not set then SAM and swinstall will startup in character mode and both will immediately fail because TERM=linux is meaningless. The two apps will ask you to supply a valid terminal ID or4 terminate.&lt;BR /&gt; &lt;BR /&gt;Now you can certainly create a linux terminal using untic and tic plus a complete read of the terminfo man page. Oh, you'll also need a complete tech refernce for the program used on the linux side as a terminal emulator so you can match up characteristics.</description>
      <pubDate>Thu, 20 Nov 2003 21:33:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122775#M151207</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2003-11-20T21:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can a .profile script dynamically set TERM?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122776#M151208</link>
      <description>Thanks Bill..&lt;BR /&gt;&lt;BR /&gt;  Good luck with your new endeavours too :)&lt;BR /&gt;&lt;BR /&gt;  I really appreciate the extremely high&lt;BR /&gt;  quality feedback on this forum.&lt;BR /&gt;&lt;BR /&gt;  I discovred that there is some kind of&lt;BR /&gt;  handshaking going on with TELNET (Doing&lt;BR /&gt;  some reading atm) clients.&lt;BR /&gt;&lt;BR /&gt;  The host seem to ask 'How are you?'&lt;BR /&gt;  The client responds with a 'I'm a  &lt;BR /&gt;  &lt;SOMETHING&gt;'&lt;BR /&gt;&lt;BR /&gt;  PC's telnetting in get a TERM of wyse60.&lt;BR /&gt;  The linux clients get a TERM of linux.&lt;BR /&gt;&lt;BR /&gt;  I found this out by having the FIRST&lt;BR /&gt;  thing the .profile script do was echo&lt;BR /&gt;  $TERM.&lt;BR /&gt;&lt;BR /&gt;  So, my only problem is the poor old glass&lt;BR /&gt;  terminals.. they get a term of '60'.&lt;BR /&gt;&lt;BR /&gt;  So.. I put an 'IF' clause into our &lt;BR /&gt;  application users .profile script that&lt;BR /&gt;  weeds out the '60' and puts in a 'wyse60'&lt;BR /&gt;  then everything works.. all three user&lt;BR /&gt;  types can log in an run our app with the&lt;BR /&gt;  one user ID as the PROGRESS 4gl is able&lt;BR /&gt;  to deal with the LINUX terminal type&lt;BR /&gt;  with its own termcap settings.&lt;BR /&gt;&lt;BR /&gt;  Probably not the most elegant way of &lt;BR /&gt;  sorting things out, but i'm getting rid of&lt;BR /&gt;  these old Wyse 60 things soon anyway.&lt;BR /&gt;&lt;BR /&gt;  Thanks heaps for your help, much appreciated! :)&lt;BR /&gt;&lt;BR /&gt;-John&lt;BR /&gt;&lt;/SOMETHING&gt;</description>
      <pubDate>Thu, 20 Nov 2003 21:47:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122776#M151208</guid>
      <dc:creator>John O'Neill_6</dc:creator>
      <dc:date>2003-11-20T21:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can a .profile script dynamically set TERM?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122777#M151209</link>
      <description>What you are seeing is the telnet protocol using subcode 31 for terminal type and window sizes. I was baffled several years ago when I discovered TERM (and COLUMNS and LINES) had been set before the start of /etc/profile. This is a great feature ONLY when every box is the same (ie, all linux). But the problem is that a PC (or linux or any other opsystem) if it sets TERM for telnet subcodes, will use something that is only meaningful to the local system. The problem is that you aren't running the app on the local system, you are running on another system and that system needs to know how to handle your terminal.&lt;BR /&gt; &lt;BR /&gt;So you want to remove the code in /etc/profile that tests for TERM being already set (HP wrote the profile code assuming every box would be 100% HP-UX). That is the job for ttytype...it will take care of the glass terminals as well as any reasonable emulator. BTW: 60 is a valid TERM value for HP-UX (hint: untic 60)</description>
      <pubDate>Thu, 20 Nov 2003 22:24:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122777#M151209</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2003-11-20T22:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can a .profile script dynamically set TERM?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122778#M151210</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Sorry, tried that... doesn't work for these rotten old terminals, hence my quest to dynamically assign TERM based on the source of the incomming connection...&lt;BR /&gt;&lt;BR /&gt;Once the old glass terminals get sent to the big compacter :) I'll remove the code in the .profile, as by then it will indeed be redundant (as you said it will) ;-).&lt;BR /&gt;&lt;BR /&gt;Effectively, the problem changed from 'how do I dynamically set the terminal for all users?' to 'how can I have dynamic allocation AND support these old terminals?'.&lt;BR /&gt;&lt;BR /&gt;These old terminals are truly awful, disgusting things, they don't properly emulate anything except Wyse60 and even that is painful and require use of the 'stty' command to get working.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;:)</description>
      <pubDate>Thu, 20 Nov 2003 22:32:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122778#M151210</guid>
      <dc:creator>John O'Neill_6</dc:creator>
      <dc:date>2003-11-20T22:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Can a .profile script dynamically set TERM?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122779#M151211</link>
      <description>I understand about old terminals. There are dumb terminals and there are comatose boxes (and emulators for that matter). The Wyse60 did have answerback capability which is how ttytype determines the various terminal types. However, you can still automate the process by using ttytype -as which will automatically set TERM=unknown for comatose terminals. You can then do something like this:&lt;BR /&gt; &lt;BR /&gt;[[ $TERM = "unknown" ]] &amp;amp;&amp;amp; TERM=wyse60&lt;BR /&gt; &lt;BR /&gt;Another usefull option for ttytype in discovering terminal types is -v as in:&lt;BR /&gt; &lt;BR /&gt;ttytype -sv&lt;BR /&gt;ttytype: ANSI terminal response "^[[?62;1;2;6;7;8;9c" mapped to "vt200"&lt;BR /&gt;ttytype: COLUMNS=80; LINES=24&lt;BR /&gt;TERM='vt200'; export TERM;&lt;BR /&gt;LINES=24; export LINES;&lt;BR /&gt;COLUMNS=80; export COLUMNS;&lt;BR /&gt;ERASE='^?'; export ERASE;</description>
      <pubDate>Fri, 21 Nov 2003 12:56:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/can-a-profile-script-dynamically-set-term/m-p/3122779#M151211</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2003-11-21T12:56:10Z</dc:date>
    </item>
  </channel>
</rss>

