<?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 expect parms from file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-parms-from-file/m-p/3215292#M169345</link>
    <description>I still cannot find out how to separate two to&lt;BR /&gt;three parameters from a input file using Expect. Anyone know how?&lt;BR /&gt;&lt;BR /&gt;Here is what I have so far. I can read each&lt;BR /&gt;line from the file but how do you tell Expect&lt;BR /&gt;to read each entry in the line as a separate&lt;BR /&gt;variable.&lt;BR /&gt;&lt;BR /&gt;#!/opt/expect/bin/expect -f&lt;BR /&gt;&lt;BR /&gt;# Querey jetdirect cards and/or change config.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;set dfile "./printers" ;# Printer hostnames &lt;BR /&gt;                           and new IP address&lt;BR /&gt;                           and gateway IP.&lt;BR /&gt;&lt;BR /&gt;set file [open $dfile r]&lt;BR /&gt;while {![eof $file]} {&lt;BR /&gt;   if {-1 == [ gets $file line ]} break ;&lt;BR /&gt;   spawn telnet $line&lt;BR /&gt;   expect {&lt;BR /&gt;      "Password:" {&lt;BR /&gt;    send "^]"&lt;BR /&gt;           expect "telnet&amp;gt; "&lt;BR /&gt;           send "quit\r"&lt;BR /&gt;           expect "Connection closed.\r"&lt;BR /&gt;    }&lt;BR /&gt;      "For HELP type \"?\"" {&lt;BR /&gt;    expect "&amp;gt; "&lt;BR /&gt;    send "?\r"&lt;BR /&gt;    #send "\r"&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;             "&amp;gt; " {&lt;BR /&gt;                  send  "/\r" ;&lt;BR /&gt;                  expect {&lt;BR /&gt;       "Press RETURN to continue:" {&lt;BR /&gt;           send "\r" ;&lt;BR /&gt;           expect "Press RETURN to continue:"&lt;BR /&gt;    send "\r"&lt;BR /&gt;           expect "Press RETURN to continue:" &lt;BR /&gt;    send "\r"&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;       "&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 "*unknown*" ;# Just ignore anything else.&lt;BR /&gt;    }&lt;BR /&gt;          }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 10 Mar 2004 18:48:32 GMT</pubDate>
    <dc:creator>jerry1</dc:creator>
    <dc:date>2004-03-10T18:48:32Z</dc:date>
    <item>
      <title>expect parms from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-parms-from-file/m-p/3215292#M169345</link>
      <description>I still cannot find out how to separate two to&lt;BR /&gt;three parameters from a input file using Expect. Anyone know how?&lt;BR /&gt;&lt;BR /&gt;Here is what I have so far. I can read each&lt;BR /&gt;line from the file but how do you tell Expect&lt;BR /&gt;to read each entry in the line as a separate&lt;BR /&gt;variable.&lt;BR /&gt;&lt;BR /&gt;#!/opt/expect/bin/expect -f&lt;BR /&gt;&lt;BR /&gt;# Querey jetdirect cards and/or change config.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;set dfile "./printers" ;# Printer hostnames &lt;BR /&gt;                           and new IP address&lt;BR /&gt;                           and gateway IP.&lt;BR /&gt;&lt;BR /&gt;set file [open $dfile r]&lt;BR /&gt;while {![eof $file]} {&lt;BR /&gt;   if {-1 == [ gets $file line ]} break ;&lt;BR /&gt;   spawn telnet $line&lt;BR /&gt;   expect {&lt;BR /&gt;      "Password:" {&lt;BR /&gt;    send "^]"&lt;BR /&gt;           expect "telnet&amp;gt; "&lt;BR /&gt;           send "quit\r"&lt;BR /&gt;           expect "Connection closed.\r"&lt;BR /&gt;    }&lt;BR /&gt;      "For HELP type \"?\"" {&lt;BR /&gt;    expect "&amp;gt; "&lt;BR /&gt;    send "?\r"&lt;BR /&gt;    #send "\r"&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;             "&amp;gt; " {&lt;BR /&gt;                  send  "/\r" ;&lt;BR /&gt;                  expect {&lt;BR /&gt;       "Press RETURN to continue:" {&lt;BR /&gt;           send "\r" ;&lt;BR /&gt;           expect "Press RETURN to continue:"&lt;BR /&gt;    send "\r"&lt;BR /&gt;           expect "Press RETURN to continue:" &lt;BR /&gt;    send "\r"&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;       "&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 "*unknown*" ;# Just ignore anything else.&lt;BR /&gt;    }&lt;BR /&gt;          }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Mar 2004 18:48:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-parms-from-file/m-p/3215292#M169345</guid>
      <dc:creator>jerry1</dc:creator>
      <dc:date>2004-03-10T18:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: expect parms from file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-parms-from-file/m-p/3215293#M169346</link>
      <description>Assume the line is a list, and run something like:&lt;BR /&gt;&lt;BR /&gt;foreach host $line {&lt;BR /&gt; ...&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Just an idea!</description>
      <pubDate>Thu, 11 Mar 2004 17:41:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-parms-from-file/m-p/3215293#M169346</guid>
      <dc:creator>George Spencer_3</dc:creator>
      <dc:date>2004-03-11T17:41:18Z</dc:date>
    </item>
  </channel>
</rss>

