<?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 If Statement in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-if-statement/m-p/3816780#M269328</link>
    <description>Lee,&lt;BR /&gt;&lt;A href="http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.43/man.html" target="_blank"&gt;http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.43/man.html&lt;/A&gt; also touches on this on Page 11</description>
    <pubDate>Tue, 04 Jul 2006 03:02:51 GMT</pubDate>
    <dc:creator>Peter Godron</dc:creator>
    <dc:date>2006-07-04T03:02:51Z</dc:date>
    <item>
      <title>Expect If Statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-if-statement/m-p/3816778#M269326</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I can't for the life of me remember where, but I've seen a script in the past that used expect, but also had an if statement within the expect code. Can anyone tell me the syntax of if statements in expect?&lt;BR /&gt;&lt;BR /&gt;I want to kind of do something like this...&lt;BR /&gt;&lt;BR /&gt;Send a command, and get expect to do one thing if it gets one string back but do something else if it gets another string back. So for example, if I ran a command, but the response was "No such file or directory" I want the script to do a certain action, but if the command succeeds and expect gets back something else I want the script to do a different action...does that make sense?&lt;BR /&gt;&lt;BR /&gt;Regards - Lee</description>
      <pubDate>Tue, 04 Jul 2006 02:32:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-if-statement/m-p/3816778#M269326</guid>
      <dc:creator>Lee Harris_5</dc:creator>
      <dc:date>2006-07-04T02:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Expect If Statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-if-statement/m-p/3816779#M269327</link>
      <description>check whether this will help&lt;BR /&gt;&lt;BR /&gt;#executes the command&lt;BR /&gt;send "$cmd\r"&lt;BR /&gt;&lt;BR /&gt;#looks for pattern for the result&lt;BR /&gt;expect -re "\[#%$].*" {&lt;BR /&gt;&lt;BR /&gt;#$expect_out(buffer) expect variable that stores the output of the command. split this by \r\n to get the result&lt;BR /&gt;&lt;BR /&gt; set dataBuff [split $expect_out(buffer) "\r\n"]&lt;BR /&gt; set result [lindex $dataBuff 2]&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;#syntax for if&lt;BR /&gt;if {$result == "something"} {&lt;BR /&gt;     &lt;BR /&gt;} else {&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Tue, 04 Jul 2006 02:50:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-if-statement/m-p/3816779#M269327</guid>
      <dc:creator>rajatnaik</dc:creator>
      <dc:date>2006-07-04T02:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Expect If Statement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-if-statement/m-p/3816780#M269328</link>
      <description>Lee,&lt;BR /&gt;&lt;A href="http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.43/man.html" target="_blank"&gt;http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.43/man.html&lt;/A&gt; also touches on this on Page 11</description>
      <pubDate>Tue, 04 Jul 2006 03:02:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-if-statement/m-p/3816780#M269328</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-07-04T03:02:51Z</dc:date>
    </item>
  </channel>
</rss>

