<?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: mp test expect script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/mp-test-expect-script/m-p/4591705#M679552</link>
    <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;You need the 'expect eof' to wait for the last command to finish.&lt;BR /&gt;&lt;BR /&gt;As for combining the shell and 'expect' scripts into one, you could use a here-document for the 'expect' script.  You could create a temporary file with the here-document that constitutes the 'expect' script; 'chmod' it to be executable; call it; and when the encapsulating shell script completes, remove the temporary file that was created.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF... &lt;BR /&gt;</description>
    <pubDate>Sat, 27 Feb 2010 01:16:21 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2010-02-27T01:16:21Z</dc:date>
    <item>
      <title>mp test expect script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mp-test-expect-script/m-p/4591701#M679548</link>
      <description>This is just a script that tests the mp password. The next one will be one that changes them ... &lt;BR /&gt;&lt;BR /&gt;But I am having problems with this one.&lt;BR /&gt;&lt;BR /&gt;First I have a script that reads the hosts list.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;for host in `cat hosts`&lt;BR /&gt;do&lt;BR /&gt;./expect2.sh $host&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/local/bin/expect -f&lt;BR /&gt;&lt;BR /&gt;set pwd mypassword &lt;BR /&gt;&lt;BR /&gt;spawn telnet [lindex $argv 0]&lt;BR /&gt;&lt;BR /&gt;# username is passed as 1st arg, password as 2nd&lt;BR /&gt;&lt;BR /&gt;        expect "*login:"&lt;BR /&gt;        send "mpadmin\r"&lt;BR /&gt;        expect "*password:"&lt;BR /&gt;        send "$pwd\r"&lt;BR /&gt;        &lt;BR /&gt;        expect -re "(.*)&amp;gt;" { send "X\n" }&lt;BR /&gt;        expect -re "(.*)login:" { send "failed $argv\n" }&lt;BR /&gt;&lt;BR /&gt;        expect eof&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If someone can show me how to combine the scripts that would be great.&lt;BR /&gt;&lt;BR /&gt;After I have this one down .. I will be working on one that changes the mp password.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Feb 2010 14:50:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mp-test-expect-script/m-p/4591701#M679548</guid>
      <dc:creator>rleon</dc:creator>
      <dc:date>2010-02-26T14:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: mp test expect script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mp-test-expect-script/m-p/4591702#M679549</link>
      <description>I also get the following error ..&lt;BR /&gt;&lt;BR /&gt;expect: spawn id exp7 not open&lt;BR /&gt;    while executing&lt;BR /&gt;"expect eof"&lt;BR /&gt;    (file "./expect2.sh" line 17)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;but when i take out the expect eof .. the script does not work right.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Feb 2010 15:02:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mp-test-expect-script/m-p/4591702#M679549</guid>
      <dc:creator>rleon</dc:creator>
      <dc:date>2010-02-26T15:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: mp test expect script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mp-test-expect-script/m-p/4591703#M679550</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;First, your shell script isn't going to give you what you want --- a simple hostname.  Instead, every whitespace delimited field of every line is going to be seen in the '$host' variable.&lt;BR /&gt;&lt;BR /&gt;You could do:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;grep -E "^[0-9]" /etc/hosts|while read HOST X&lt;BR /&gt;do&lt;BR /&gt;    ./expect2.sh ${HOST}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;...which would find only lines beginning with a digit which should represent valid hosts.&lt;BR /&gt;&lt;BR /&gt;As for "combining" the shell and the 'expect' script, why?&lt;BR /&gt;&lt;BR /&gt;You would be far better served if you leave the 'expect' script as a functional, standalone script that is called however you need to call it.  In this case you call it passing every hostname in an '/etc/hosts' file.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 26 Feb 2010 15:17:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mp-test-expect-script/m-p/4591703#M679550</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-02-26T15:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: mp test expect script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mp-test-expect-script/m-p/4591704#M679551</link>
      <description>Thanks for your response mr james but I am not ready the /etc/hosts file .. it is just a regular file named hosts with a list of all the hostnames.&lt;BR /&gt;&lt;BR /&gt;My main issue is I get the following error ..&lt;BR /&gt;&lt;BR /&gt;expect: spawn id exp7 not open&lt;BR /&gt;while executing&lt;BR /&gt;"expect eof"&lt;BR /&gt;(file "./expect2.sh" line 17)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;but when i take out the expect eof .. the script does not work right.</description>
      <pubDate>Fri, 26 Feb 2010 15:25:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mp-test-expect-script/m-p/4591704#M679551</guid>
      <dc:creator>rleon</dc:creator>
      <dc:date>2010-02-26T15:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: mp test expect script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mp-test-expect-script/m-p/4591705#M679552</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;You need the 'expect eof' to wait for the last command to finish.&lt;BR /&gt;&lt;BR /&gt;As for combining the shell and 'expect' scripts into one, you could use a here-document for the 'expect' script.  You could create a temporary file with the here-document that constitutes the 'expect' script; 'chmod' it to be executable; call it; and when the encapsulating shell script completes, remove the temporary file that was created.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF... &lt;BR /&gt;</description>
      <pubDate>Sat, 27 Feb 2010 01:16:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mp-test-expect-script/m-p/4591705#M679552</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-02-27T01:16:21Z</dc:date>
    </item>
  </channel>
</rss>

