<?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: if else statement in expect script? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/if-else-statement-in-expect-script/m-p/4765622#M657352</link>
    <description>HI:&lt;BR /&gt;&lt;BR /&gt;You might look at:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://wiki.tcl.tk/11583" target="_blank"&gt;http://wiki.tcl.tk/11583&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Wed, 16 Mar 2011 00:09:05 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2011-03-16T00:09:05Z</dc:date>
    <item>
      <title>if else statement in expect script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-else-statement-in-expect-script/m-p/4765621#M657351</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I was wondering if there was a way to an if else statement in an expect script?&lt;BR /&gt;&lt;BR /&gt;I have a file&lt;BR /&gt;&lt;BR /&gt;host1&lt;BR /&gt;host2&lt;BR /&gt;host3&lt;BR /&gt;&lt;BR /&gt;And a shell script that executes the the expect script and passes the variable.&lt;BR /&gt;&lt;BR /&gt;for host in $(cat $hosts_file) &lt;BR /&gt;do &lt;BR /&gt;./expect.sh $host&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/local/bin/expect&lt;BR /&gt;&lt;BR /&gt;set timeout 1&lt;BR /&gt;&lt;BR /&gt;set hostname [lindex $argv 0]&lt;BR /&gt;&lt;BR /&gt;spawn telnet $hostname&lt;BR /&gt;&lt;BR /&gt;expect ogin: &lt;BR /&gt;&lt;BR /&gt;send user\r &lt;BR /&gt;&lt;BR /&gt;expect ssword:&lt;BR /&gt;&lt;BR /&gt;send userpass\r&lt;BR /&gt;&lt;BR /&gt;expect "&amp;gt;"&lt;BR /&gt;&lt;BR /&gt;send "exit\r" &lt;BR /&gt;&lt;BR /&gt;expect closed&lt;BR /&gt;&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;But some of the hostnames are not online or the password failed.&lt;BR /&gt;&lt;BR /&gt;Can you do if else statements in expect?&lt;BR /&gt;&lt;BR /&gt;I would like to log the failures into a logfile.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Mar 2011 17:50:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-else-statement-in-expect-script/m-p/4765621#M657351</guid>
      <dc:creator>rleon</dc:creator>
      <dc:date>2011-03-15T17:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: if else statement in expect script?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-else-statement-in-expect-script/m-p/4765622#M657352</link>
      <description>HI:&lt;BR /&gt;&lt;BR /&gt;You might look at:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://wiki.tcl.tk/11583" target="_blank"&gt;http://wiki.tcl.tk/11583&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 16 Mar 2011 00:09:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-else-statement-in-expect-script/m-p/4765622#M657352</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-03-16T00:09:05Z</dc:date>
    </item>
  </channel>
</rss>

