<?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: How to write shell script for interact with binary application(tty problem)? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402365#M351769</link>
    <description>Laurent, How can I write it in loop for my script as below? Because I want to terminate many users from the list.&lt;BR /&gt;&lt;BR /&gt;for z in `cat terminate_list.txt`&lt;BR /&gt;do&lt;BR /&gt;VENDER_tool &amp;lt;&amp;lt; EOT&lt;BR /&gt;logoff user=$z&lt;BR /&gt;quit&lt;BR /&gt;EOT&lt;BR /&gt;done</description>
    <pubDate>Sat, 18 Apr 2009 01:16:50 GMT</pubDate>
    <dc:creator>gto481</dc:creator>
    <dc:date>2009-04-18T01:16:50Z</dc:date>
    <item>
      <title>How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402359#M351763</link>
      <description>I would like to write a shell script to interact with binary application reside on unix ssytem. But when I run my script, I got "Not a tty" error message. I have the same problem with this thread &lt;A href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1239893865321+28353475&amp;amp;threadId=134688" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1239893865321+28353475&amp;amp;threadId=134688&lt;/A&gt; . They suggested to use expect to interact with binary application. But I can not use expect because I don't have permission to install it into unix machine due to security issue. Could you guy have another method or solution for this issue?</description>
      <pubDate>Thu, 16 Apr 2009 14:08:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402359#M351763</guid>
      <dc:creator>gto481</dc:creator>
      <dc:date>2009-04-16T14:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402360#M351764</link>
      <description>What is your application? Does it open /dev/tty and get its input from that device?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Else the more easy way to interact with a program is to use coprocess&lt;BR /&gt;&lt;BR /&gt;example:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;telnet localhost  |&amp;amp;&lt;BR /&gt;&lt;BR /&gt;exec 3&amp;gt;&amp;amp;p 4&amp;lt;&amp;amp;p&lt;BR /&gt;&lt;BR /&gt;sleep 1&lt;BR /&gt;echo laurent &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;echo mypasswd &amp;gt;&amp;amp;3&lt;BR /&gt;echo echo debut&amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;while read a&lt;BR /&gt;do&lt;BR /&gt; if [ "$a" = "begin" ]&lt;BR /&gt; then&lt;BR /&gt;   echo ls &amp;gt;&amp;amp;3&lt;BR /&gt;   echo exit &amp;gt;&amp;amp;3&lt;BR /&gt;   cat &amp;amp;&lt;BR /&gt;   break&lt;BR /&gt; fi&lt;BR /&gt;done&lt;BR /&gt;done &amp;lt;&amp;amp;4 &lt;BR /&gt; &lt;BR /&gt;but if your application is using /dev/tty&lt;BR /&gt;- like more- , then  you can't do that, but you must use&lt;BR /&gt;a telnet localhost to have a tty, then being able to echo and read from it.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;telnet localhost  |&amp;amp;&lt;BR /&gt;&lt;BR /&gt;exec 3&amp;gt;&amp;amp;p 4&amp;lt;&amp;amp;p&lt;BR /&gt;&lt;BR /&gt;sleep 1&lt;BR /&gt;echo laurent &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;echo mypasswd &amp;gt;&amp;amp;3&lt;BR /&gt;echo echo debut&amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;while read a&lt;BR /&gt;do&lt;BR /&gt; if [ "$a" = "begin" ]&lt;BR /&gt; then&lt;BR /&gt;   echo more /var/adm/syslog/syslog.log &amp;gt;&amp;amp;3&lt;BR /&gt;   cat &amp;amp;&lt;BR /&gt;   sleep 2&lt;BR /&gt;&lt;BR /&gt;   echo &amp;gt;&amp;amp;3&lt;BR /&gt;   echo &amp;gt;&amp;amp;3&lt;BR /&gt;   echo &amp;gt;&amp;amp;3&lt;BR /&gt;   break&lt;BR /&gt; fi&lt;BR /&gt;done&lt;BR /&gt;done &amp;lt;&amp;amp;4 &lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Apr 2009 14:30:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402360#M351764</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2009-04-16T14:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402361#M351765</link>
      <description>&amp;gt;when I run my script, I got "Not a tty" error message.&lt;BR /&gt;&lt;BR /&gt;Where are you getting it?  From /etc/profile or  ~/.profile?  If so, you need to fix them.</description>
      <pubDate>Fri, 17 Apr 2009 04:13:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402361#M351765</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-17T04:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402362#M351766</link>
      <description>if you connect to another server and interact with it, shell is not good; &lt;BR /&gt;But yes, you can use expect if you have it installed in your environment. Actually Expect somehow a component or extension of TCL language;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://en.wikipedia.org/wiki/Expect" target="_blank"&gt;http://en.wikipedia.org/wiki/Expect&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt; you can use Expect it is very suitable for interact and most cases it is similar to TCL and user friendly.&lt;BR /&gt;&lt;A href="http://en.wikipedia.org/wiki/Tcl" target="_blank"&gt;http://en.wikipedia.org/wiki/Tcl&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Apr 2009 05:19:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402362#M351766</guid>
      <dc:creator>Hakki Aydin Ucar</dc:creator>
      <dc:date>2009-04-17T05:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402363#M351767</link>
      <description>Laurent, This application is from vendor so I don't know it open /dev/tty or not because I believe it has internal algorithm to check whether user run it via shell script or not.</description>
      <pubDate>Fri, 17 Apr 2009 13:47:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402363#M351767</guid>
      <dc:creator>gto481</dc:creator>
      <dc:date>2009-04-17T13:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402364#M351768</link>
      <description>you could try a tusc -v -f -p of your script, and you will be able to find out where that message comes from&lt;BR /&gt;&lt;BR /&gt;are you starting your script from a console, a telnet session? a ssh session a rlogin session?&lt;BR /&gt;&lt;BR /&gt;or a ssh remote command remsh remote command?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;else if the application need to run in a pty with a pty as stdin/stdout/stderr, the more easy to do it is using telnet coprocess&lt;BR /&gt;&lt;BR /&gt;because you can pipe to/from telnet process and it will be transmitted to your application through a pty.&lt;BR /&gt;&lt;BR /&gt;so&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;telnet localhost |&amp;amp;&lt;BR /&gt;&lt;BR /&gt;exec 3&amp;gt;&amp;amp;p 4&amp;lt;&amp;amp;p&lt;BR /&gt;&lt;BR /&gt;sleep 1&lt;BR /&gt;echo myuser &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;echo mypass &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 2&lt;BR /&gt;echo mycmd &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;=======&lt;BR /&gt;then when you read from 4 ( read -p 4 a )&lt;BR /&gt;and and pass answers using echo "answers" &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Apr 2009 14:05:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402364#M351768</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2009-04-17T14:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402365#M351769</link>
      <description>Laurent, How can I write it in loop for my script as below? Because I want to terminate many users from the list.&lt;BR /&gt;&lt;BR /&gt;for z in `cat terminate_list.txt`&lt;BR /&gt;do&lt;BR /&gt;VENDER_tool &amp;lt;&amp;lt; EOT&lt;BR /&gt;logoff user=$z&lt;BR /&gt;quit&lt;BR /&gt;EOT&lt;BR /&gt;done</description>
      <pubDate>Sat, 18 Apr 2009 01:16:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402365#M351769</guid>
      <dc:creator>gto481</dc:creator>
      <dc:date>2009-04-18T01:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402366#M351770</link>
      <description>&lt;!--!*#--&gt;&amp;gt;How can I write it in loop for my script as below?&lt;BR /&gt;&lt;BR /&gt;What happens when you use your script?  You get that "Not a tty" every time through the loop?&lt;BR /&gt;&lt;BR /&gt;Can your VENDER_tool take multiple lines with:&lt;BR /&gt;logoff user=User1&lt;BR /&gt;logoff user=User2&lt;BR /&gt;&lt;BR /&gt;If so, you should at least batch them up so you only invoke it once:&lt;BR /&gt;(&lt;BR /&gt;for z in $(&amp;lt; terminate_list.txt); do&lt;BR /&gt;   echo "logoff user=$z"&lt;BR /&gt;done&lt;BR /&gt;echo quit&lt;BR /&gt;) &amp;gt; tool_input</description>
      <pubDate>Sat, 18 Apr 2009 07:07:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402366#M351770</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-18T07:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402367#M351771</link>
      <description>Dennis, Did you mean to write shell script like this? I've tried to execute it but still no luck. I got no error message but users still not logoff. Are there anything wrong with script below?&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;              &lt;BR /&gt;telnet localhost |&amp;amp;&lt;BR /&gt;              &lt;BR /&gt;exec 3&amp;gt;&amp;amp;p 4&amp;lt;&amp;amp;p&lt;BR /&gt;              &lt;BR /&gt;sleep 1       &lt;BR /&gt;echo username &amp;gt;&amp;amp;3  &lt;BR /&gt;sleep 1       &lt;BR /&gt;echo password &amp;gt;&amp;amp;3  &lt;BR /&gt;sleep 2&lt;BR /&gt;echo &amp;gt;&amp;amp;3      &lt;BR /&gt;sleep 1       &lt;BR /&gt;echo &amp;gt;&amp;amp;3      &lt;BR /&gt;sleep 1       &lt;BR /&gt;echo &amp;gt;&amp;amp;3      &lt;BR /&gt;              &lt;BR /&gt;while read a  &lt;BR /&gt;do   &lt;BR /&gt;(             &lt;BR /&gt;for z in $(&amp;lt; terminate_list.txt); do&lt;BR /&gt;   echo "logoff user=$z"&lt;BR /&gt;done          &lt;BR /&gt;echo quit     &lt;BR /&gt;) &amp;gt; VENDER_tool  &lt;BR /&gt;cat &amp;amp;         &lt;BR /&gt;sleep 2       &lt;BR /&gt;              &lt;BR /&gt;echo &amp;gt;&amp;amp;3      &lt;BR /&gt;echo &amp;gt;&amp;amp;3      &lt;BR /&gt;echo &amp;gt;&amp;amp;3      &lt;BR /&gt;break         &lt;BR /&gt;done &amp;lt;&amp;amp;4</description>
      <pubDate>Sat, 18 Apr 2009 17:19:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402367#M351771</guid>
      <dc:creator>gto481</dc:creator>
      <dc:date>2009-04-18T17:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402368#M351772</link>
      <description>&lt;!--!*#--&gt;&amp;gt;Did you mean to write shell script like this?&lt;BR /&gt;&lt;BR /&gt;Not exactly.  ;-)&lt;BR /&gt;&lt;BR /&gt;Before your while:&lt;BR /&gt;&lt;BR /&gt;# here you should read all of the input from your login.  This decades old trick may work:&lt;BR /&gt;&lt;BR /&gt;echo "echo EOF1" &amp;gt;&amp;amp;3&lt;BR /&gt;while read A; do&lt;BR /&gt;   if [ "$A" = EOF1 ]; then break; fi&lt;BR /&gt;   echo "$A"&lt;BR /&gt;done &amp;lt;&amp;amp;4&lt;BR /&gt;&lt;BR /&gt;echo VENDER_tool &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;Replace your while:&lt;BR /&gt;&lt;BR /&gt;(&lt;BR /&gt;for z in $(&amp;lt; terminate_list.txt); do&lt;BR /&gt;   echo "logoff user=$z"&lt;BR /&gt;done&lt;BR /&gt;echo quit&lt;BR /&gt;) &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;# I'm assuming the buffers are large enough so you don't have to read each reply?&lt;BR /&gt;&lt;BR /&gt;# Here you should read all of those replies. except you don't have an idea when to quit.&lt;BR /&gt;&lt;BR /&gt;echo "echo EOF2" &amp;gt;&amp;amp;3&lt;BR /&gt;while read A; do&lt;BR /&gt;   if [ "$A" = EOF2 ]; then break; fi&lt;BR /&gt;   echo "$A"&lt;BR /&gt;done &amp;lt;&amp;amp;4&lt;BR /&gt;&lt;BR /&gt;# now logoff&lt;BR /&gt;echo "exit" &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;# terminate telnet (You'll need control V to enter that control char.)&lt;BR /&gt;echo "^]" &amp;gt; &amp;amp;3&lt;BR /&gt;echo "quit" &amp;gt;&amp;amp;3</description>
      <pubDate>Sun, 19 Apr 2009 00:25:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402368#M351772</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-19T00:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402369#M351773</link>
      <description>Dennis, Thank you for your help but I still having a problem when I enter the following value before my "while" as your comment.&lt;BR /&gt;&lt;BR /&gt;echo "echo EOF1" &amp;gt;&amp;amp;3&lt;BR /&gt;while read A; do&lt;BR /&gt;   if [ "$A" = EOF1 ]; then break; fi&lt;BR /&gt;   echo "$A"&lt;BR /&gt;done &amp;lt;&amp;amp;4&lt;BR /&gt;&lt;BR /&gt;It struck at EOF1 and not going to run into next step.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; echo EOF1&lt;BR /&gt;EOF1</description>
      <pubDate>Sun, 19 Apr 2009 07:54:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402369#M351773</guid>
      <dc:creator>gto481</dc:creator>
      <dc:date>2009-04-19T07:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402370#M351774</link>
      <description>&lt;!--!*#--&gt;&amp;gt;when I enter the following value before my "while" as your comment.&lt;BR /&gt;&lt;BR /&gt;(I tossed your while out.)&lt;BR /&gt;&lt;BR /&gt;echo "echo EOF1" &amp;gt;&amp;amp;3&lt;BR /&gt;while read A; do&lt;BR /&gt;   if [ "$A" = EOF1 ]; then break; fi&lt;BR /&gt;   echo "LOOP1: $A"&lt;BR /&gt;done &amp;lt;&amp;amp;4&lt;BR /&gt;&lt;BR /&gt;I just added "LOOP1:" above so you know which is which.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;It's struck at EOF1 and not going to run into next step.&lt;BR /&gt;&lt;BR /&gt;Hmm.  What stuff is echoed there?  The intention is that the "remote" shell is going to see that echo and echo EOF1.  Then the script will break out of the loop.</description>
      <pubDate>Sun, 19 Apr 2009 10:39:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402370#M351774</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-19T10:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402371#M351775</link>
      <description>It works. Thank you Dennis.</description>
      <pubDate>Thu, 23 Apr 2009 04:44:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402371#M351775</guid>
      <dc:creator>gto481</dc:creator>
      <dc:date>2009-04-23T04:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402372#M351776</link>
      <description>&amp;gt;It works.&lt;BR /&gt;&lt;BR /&gt;What was it you fixed that made it work?</description>
      <pubDate>Thu, 23 Apr 2009 05:26:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402372#M351776</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-23T05:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402373#M351777</link>
      <description>I changed if to case as below.&lt;BR /&gt;&lt;BR /&gt;echo "echo EOT2" &amp;gt;&amp;amp;3&lt;BR /&gt;while read a&lt;BR /&gt;do&lt;BR /&gt;case $a in&lt;BR /&gt;     *EOT2*) break ;;&lt;BR /&gt;esac&lt;BR /&gt;   echo "$a"&lt;BR /&gt;done &amp;lt;&amp;amp;4</description>
      <pubDate>Fri, 24 Apr 2009 05:06:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402373#M351777</guid>
      <dc:creator>gto481</dc:creator>
      <dc:date>2009-04-24T05:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402374#M351778</link>
      <description>&amp;gt; *EOT2*) break ;;&lt;BR /&gt;&lt;BR /&gt;I was wondering if there were extra stuff on the lines.  If you actually echo $a, you might find out what's extra.  The prompt?</description>
      <pubDate>Fri, 24 Apr 2009 05:28:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402374#M351778</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-24T05:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402375#M351779</link>
      <description>I got &amp;gt;EOT2 after echo "echo EOT2" &amp;gt;&amp;amp;3 and script stuck on &amp;gt; prompt. I'm not sure why script did terminate after got EOT2. I think it would be some space or another char that I didn't see before or after EOT2. So I use wildcard for fix this problem. Another thing is after script terminated, I saw telnet localhost process still exist. How can I terminate it after script terminated? Below is my final script.&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;telnet localhost |&amp;amp;&lt;BR /&gt;&lt;BR /&gt;exec 3&amp;gt;&amp;amp;p 4&amp;lt;&amp;amp;p&lt;BR /&gt;&lt;BR /&gt;sleep 1&lt;BR /&gt;echo myuser &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;echo mypass &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 3&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;&lt;BR /&gt;echo VENDER_tool &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;(&lt;BR /&gt;for z in $(&amp;lt; terminate_list.txt); do&lt;BR /&gt;   echo "logoff user=$z"&lt;BR /&gt;done&lt;BR /&gt;sleep 2&lt;BR /&gt;echo quit&lt;BR /&gt;) &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;cat &amp;amp;&lt;BR /&gt;sleep 2&lt;BR /&gt;&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;echo "echo EOT2" &amp;gt;&amp;amp;3&lt;BR /&gt;while read a&lt;BR /&gt;do&lt;BR /&gt;case $a in&lt;BR /&gt;     *EOT2*) break ;;&lt;BR /&gt;esac&lt;BR /&gt;   echo "$a"&lt;BR /&gt;done &amp;lt;&amp;amp;4&lt;BR /&gt;&lt;BR /&gt;echo "exit" &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;It seems after script terminated by got EOT2 and break. It will not process on echo "exit" &amp;gt;&amp;amp;3</description>
      <pubDate>Fri, 24 Apr 2009 06:05:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402375#M351779</guid>
      <dc:creator>gto481</dc:creator>
      <dc:date>2009-04-24T06:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402376#M351780</link>
      <description>&amp;gt;I saw telnet localhost process still exist. How can I terminate it after script terminated? &lt;BR /&gt;&lt;BR /&gt;You didn't put all of this at the end of your script:&lt;BR /&gt;# now logoff&lt;BR /&gt;echo "exit" &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;# terminate telnet (You'll need control V to enter that control char.)&lt;BR /&gt;echo "^]" &amp;gt; &amp;amp;3&lt;BR /&gt;echo "quit" &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;&amp;gt;It will not process on echo "exit" &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;Do you ever get to this echo?&lt;BR /&gt;What happened to my EOF1 loop before you start VENDER_tool?</description>
      <pubDate>Fri, 24 Apr 2009 07:26:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402376#M351780</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-24T07:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402377#M351781</link>
      <description>Sorry Dennis for my late reply. I modified my script as your comment as below and still I never got "echo exit" on my screen after run this script. The script terminated after it got "echo EOT2" thus telnet localhost process still not terminate. What should I do?&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;telnet localhost |&amp;amp;&lt;BR /&gt;&lt;BR /&gt;exec 3&amp;gt;&amp;amp;p 4&amp;lt;&amp;amp;p&lt;BR /&gt;&lt;BR /&gt;sleep 1&lt;BR /&gt;echo myuser &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;echo mypass &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 3&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;&lt;BR /&gt;echo "echo EOF1" &amp;gt;&amp;amp;3&lt;BR /&gt;while read a&lt;BR /&gt;do&lt;BR /&gt;case $a in&lt;BR /&gt;     *EOF1*) break ;;&lt;BR /&gt;esac&lt;BR /&gt;   echo "$a"&lt;BR /&gt;done &amp;lt;&amp;amp;4&lt;BR /&gt;&lt;BR /&gt;echo VENDER_tool &amp;gt;&amp;amp;3&lt;BR /&gt;sleep 1&lt;BR /&gt;(&lt;BR /&gt;for z in $(&amp;lt; terminate_list.txt); do&lt;BR /&gt;echo "logoff user=$z"&lt;BR /&gt;done&lt;BR /&gt;sleep 2&lt;BR /&gt;echo quit&lt;BR /&gt;) &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;cat &amp;amp;&lt;BR /&gt;sleep 2&lt;BR /&gt;&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;echo &amp;gt;&amp;amp;3&lt;BR /&gt;&lt;BR /&gt;echo "echo EOT2" &amp;gt;&amp;amp;3&lt;BR /&gt;while read a&lt;BR /&gt;do&lt;BR /&gt;case $a in&lt;BR /&gt;*EOT2*) break ;;&lt;BR /&gt;esac&lt;BR /&gt;echo "$a"&lt;BR /&gt;done &amp;lt;&amp;amp;4&lt;BR /&gt;&lt;BR /&gt;echo "exit" &amp;gt;&amp;amp;3&lt;BR /&gt;echo "^]"&amp;amp;3&lt;BR /&gt;echo "quit" &amp;gt;&amp;amp;3&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Apr 2009 02:50:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402377#M351781</guid>
      <dc:creator>gto481</dc:creator>
      <dc:date>2009-04-29T02:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to write shell script for interact with binary application(tty problem)?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402378#M351782</link>
      <description>&amp;gt;still I never got "echo exit" on my screen after run this script. The script terminated after it got "echo EOT2" thus telnet localhost process still not terminate. What should I do?&lt;BR /&gt;&lt;BR /&gt;I was never sure what this did?&lt;BR /&gt;cat &amp;amp; &lt;BR /&gt;&lt;BR /&gt;It seems like it hangs waiting for input?&lt;BR /&gt;&lt;BR /&gt;Some typos here:&lt;BR /&gt;echo "exit" &amp;gt;&amp;amp;3  # this should exit the remote shell and not be seen&lt;BR /&gt;# Need to use control-] on the next line:&lt;BR /&gt;echo "^]" &amp;gt;&amp;amp;3    # this should escape from telnet&lt;BR /&gt;echo "quit" &amp;gt;&amp;amp;3  # this should quit telnet&lt;BR /&gt;&lt;BR /&gt;I'm assuming we don't have to read from 4 here and the buffer is large enough?&lt;BR /&gt;&lt;BR /&gt;You might want to remove the VENDER_tool loop to make sure the rest work.</description>
      <pubDate>Wed, 29 Apr 2009 04:39:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-write-shell-script-for-interact-with-binary-application/m-p/4402378#M351782</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-04-29T04:39:44Z</dc:date>
    </item>
  </channel>
</rss>

