<?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: expect in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193481#M165166</link>
    <description>This is what I was able to come up with but&lt;BR /&gt;it continues to loop for only the first line in the data file. Its not going to the next entry. &lt;BR /&gt;&lt;BR /&gt;This is connecting to an HP jetdirect card so the expects are okay and it works on the first one from the data file but does not get the next enry. Something wrong with the "while" statement.&lt;BR /&gt;&lt;BR /&gt;Can anyone help? &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/opt/expect/bin/expect -f&lt;BR /&gt;&lt;BR /&gt;set dfile "./testdata"&lt;BR /&gt;&lt;BR /&gt;set file [open $dfile r]&lt;BR /&gt;gets $file line&lt;BR /&gt;while {![eof $file]} {&lt;BR /&gt;spawn telnet $line&lt;BR /&gt;expect "&amp;gt; "&lt;BR /&gt;send  "/\r"&lt;BR /&gt;expect "&amp;gt; "&lt;BR /&gt;send  "exit\r"&lt;BR /&gt;expect "Connection closed by foreign host.\r"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;expect eof&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 19 Feb 2004 10:54:21 GMT</pubDate>
    <dc:creator>jerry1</dc:creator>
    <dc:date>2004-02-19T10:54:21Z</dc:date>
    <item>
      <title>expect</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193476#M165161</link>
      <description>Does anyone know how to pass args from a file&lt;BR /&gt;to an expect script or using autoexpect.&lt;BR /&gt;&lt;BR /&gt;Just need to do a:&lt;BR /&gt;&lt;BR /&gt;for i in &lt;FILE&gt;;do&lt;BR /&gt;telnet $i   &lt;BR /&gt;&lt;COMMAND&gt;&lt;BR /&gt;&lt;COMMAND&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;But pass the other commands also.&lt;BR /&gt;How would you get autoexpect to do this or&lt;BR /&gt;just in an expect file?&lt;BR /&gt;&lt;BR /&gt;Would anyone have a similar example that I &lt;BR /&gt;could modify?&lt;BR /&gt;&lt;/COMMAND&gt;&lt;/COMMAND&gt;&lt;/FILE&gt;</description>
      <pubDate>Mon, 16 Feb 2004 17:05:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193476#M165161</guid>
      <dc:creator>jerry1</dc:creator>
      <dc:date>2004-02-16T17:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: expect</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193477#M165162</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;In expect you can use argc and argv to capture the arguments.&lt;BR /&gt;&lt;BR /&gt;Look at 'passmass' example under wherever_expect_is/bin directory if you already have expect installed. &lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;for {set i 0} {$i&amp;lt;$argc} {incr i} {&lt;BR /&gt;    set arg [lindex $argv $i]&lt;BR /&gt;    switch -- $arg "-user" {....}&lt;BR /&gt;...&lt;BR /&gt;    set host $arg&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Mon, 16 Feb 2004 17:13:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193477#M165162</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-02-16T17:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: expect</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193478#M165163</link>
      <description>Attached is an example I use to start a command that requires a password. No password is echoed to the screen, just picked up from a file.</description>
      <pubDate>Mon, 16 Feb 2004 17:21:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193478#M165163</guid>
      <dc:creator>Michael Tully</dc:creator>
      <dc:date>2004-02-16T17:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: expect</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193479#M165164</link>
      <description>As a Plan B, you might consider using Perl's NET::Telnet module. It can login automatically using .netrc, if you like, and you get expect-like pattern matching for free. Man Net::Telnet for details and several useful examples. Even if you don't know Perl, the examples will all but get you through it.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Feb 2004 17:30:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193479#M165164</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-02-16T17:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: expect</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193480#M165165</link>
      <description>What I am trying to do is have a file with &lt;BR /&gt;&lt;BR /&gt;&lt;PRINTER1 hostname=""&gt; &lt;NEW ip=""&gt;&lt;BR /&gt;&lt;PRINTER2 hostname=""&gt; &lt;NEW ip=""&gt;&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;That I have to use to telnet to the jetdirect cards and reset the IP and Gateway addresses. I have over 200 printers that have to be done so manually going to the printers would take about 60 hours or having to telnet to each printer manually and manually changing them would be just about as bad.&lt;BR /&gt;&lt;BR /&gt;Since I can create an autoexpect script to do a telnet &lt;HOSTNAME&gt;. I could not figure out how to pass each line of input from the file to the expect script.&lt;BR /&gt;&lt;BR /&gt;Thanks to all for your input.&lt;BR /&gt;I will checkout the info you posted.&lt;BR /&gt;&lt;BR /&gt;&lt;/HOSTNAME&gt;&lt;/NEW&gt;&lt;/PRINTER2&gt;&lt;/NEW&gt;&lt;/PRINTER1&gt;</description>
      <pubDate>Tue, 17 Feb 2004 09:18:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193480#M165165</guid>
      <dc:creator>jerry1</dc:creator>
      <dc:date>2004-02-17T09:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: expect</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193481#M165166</link>
      <description>This is what I was able to come up with but&lt;BR /&gt;it continues to loop for only the first line in the data file. Its not going to the next entry. &lt;BR /&gt;&lt;BR /&gt;This is connecting to an HP jetdirect card so the expects are okay and it works on the first one from the data file but does not get the next enry. Something wrong with the "while" statement.&lt;BR /&gt;&lt;BR /&gt;Can anyone help? &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/opt/expect/bin/expect -f&lt;BR /&gt;&lt;BR /&gt;set dfile "./testdata"&lt;BR /&gt;&lt;BR /&gt;set file [open $dfile r]&lt;BR /&gt;gets $file line&lt;BR /&gt;while {![eof $file]} {&lt;BR /&gt;spawn telnet $line&lt;BR /&gt;expect "&amp;gt; "&lt;BR /&gt;send  "/\r"&lt;BR /&gt;expect "&amp;gt; "&lt;BR /&gt;send  "exit\r"&lt;BR /&gt;expect "Connection closed by foreign host.\r"&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;expect eof&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 19 Feb 2004 10:54:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect/m-p/3193481#M165166</guid>
      <dc:creator>jerry1</dc:creator>
      <dc:date>2004-02-19T10:54:21Z</dc:date>
    </item>
  </channel>
</rss>

