<?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 script... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script/m-p/3395637#M705950</link>
    <description>Ok, so this is my first time using expect. I installed it and configured it fine and for the most part it's working, but I can't seem to execute any commands after I login (at least I don't think it's executing anything). I can log in fine, but it just logs out at the end, it's not showing me that it executed the "ls" command or "find" command. Any help please! This just smells of a bunny:) Here is my script:&lt;BR /&gt;&lt;BR /&gt;------------&lt;BR /&gt;#!/usr/local/bin/expect -d&lt;BR /&gt;&lt;BR /&gt;spawn /usr/local/bin/ssh root@&lt;HOST&gt;&lt;BR /&gt;expect "root@&lt;HOST&gt;'s password: "&lt;BR /&gt;send "&lt;PASSWORD&gt;\r"&lt;BR /&gt;expect "# "&lt;BR /&gt;send "find / -name TEMPFILE \r"&lt;BR /&gt;send "bye\r"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;--------------&lt;BR /&gt;To execute I just run ./backups.sh&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;-Hazem&lt;/PASSWORD&gt;&lt;/HOST&gt;&lt;/HOST&gt;</description>
    <pubDate>Thu, 07 Oct 2004 12:15:24 GMT</pubDate>
    <dc:creator>Hazem Mahmoud_3</dc:creator>
    <dc:date>2004-10-07T12:15:24Z</dc:date>
    <item>
      <title>Expect script...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script/m-p/3395637#M705950</link>
      <description>Ok, so this is my first time using expect. I installed it and configured it fine and for the most part it's working, but I can't seem to execute any commands after I login (at least I don't think it's executing anything). I can log in fine, but it just logs out at the end, it's not showing me that it executed the "ls" command or "find" command. Any help please! This just smells of a bunny:) Here is my script:&lt;BR /&gt;&lt;BR /&gt;------------&lt;BR /&gt;#!/usr/local/bin/expect -d&lt;BR /&gt;&lt;BR /&gt;spawn /usr/local/bin/ssh root@&lt;HOST&gt;&lt;BR /&gt;expect "root@&lt;HOST&gt;'s password: "&lt;BR /&gt;send "&lt;PASSWORD&gt;\r"&lt;BR /&gt;expect "# "&lt;BR /&gt;send "find / -name TEMPFILE \r"&lt;BR /&gt;send "bye\r"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;--------------&lt;BR /&gt;To execute I just run ./backups.sh&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;-Hazem&lt;/PASSWORD&gt;&lt;/HOST&gt;&lt;/HOST&gt;</description>
      <pubDate>Thu, 07 Oct 2004 12:15:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script/m-p/3395637#M705950</guid>
      <dc:creator>Hazem Mahmoud_3</dc:creator>
      <dc:date>2004-10-07T12:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script/m-p/3395638#M705951</link>
      <description>Try using the -f option as well, and then &lt;BR /&gt;embed the expect commands in a "here" file in the script:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;/usr/local/bin/expect -d -f &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;set timeout -1&lt;BR /&gt;match_max 100000&lt;BR /&gt;spawn /usr/local/bin/ssh root@&lt;HOST&gt;&lt;BR /&gt;expect "root@&lt;HOST&gt;'s password: "&lt;BR /&gt;send "&lt;PASSWORD&gt;\r"&lt;BR /&gt;expect "# "&lt;BR /&gt;send "find / -name TEMPFILE \r"&lt;BR /&gt;send "bye\r"&lt;BR /&gt;&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;Note the two lines I added as well.&lt;BR /&gt;&lt;BR /&gt;mark&lt;BR /&gt;&lt;/PASSWORD&gt;&lt;/HOST&gt;&lt;/HOST&gt;</description>
      <pubDate>Thu, 07 Oct 2004 12:29:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script/m-p/3395638#M705951</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2004-10-07T12:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script/m-p/3395639#M705952</link>
      <description>Hi Hazem,&lt;BR /&gt;&lt;BR /&gt;There should be some expectation after you send 'find / -name" commmand. So, modify it as&lt;BR /&gt;&lt;BR /&gt;expect "# "&lt;BR /&gt;send "find / -name TEMPFILE \r"&lt;BR /&gt;expect "# "&lt;BR /&gt;send "exit\r"&lt;BR /&gt;&lt;BR /&gt;You can also do a &lt;BR /&gt;&lt;BR /&gt;set pid [spawn /usr/local/bin/ssh root@&lt;HOST&gt;]&lt;BR /&gt;&lt;BR /&gt;After send 'exit\r', you can add 'exec kill $pid' just to make sure the telnet session gets killed. &lt;BR /&gt;&lt;BR /&gt;-Sri&lt;/HOST&gt;</description>
      <pubDate>Thu, 07 Oct 2004 17:31:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script/m-p/3395639#M705952</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-10-07T17:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Expect script...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-script/m-p/3395640#M705953</link>
      <description>And the bunny goes to Sridhar!!!! That did it!!! Thank you!!! Thanks for your suggestions as well Mark!&lt;BR /&gt;&lt;BR /&gt;-Hazem</description>
      <pubDate>Fri, 08 Oct 2004 14:43:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-script/m-p/3395640#M705953</guid>
      <dc:creator>Hazem Mahmoud_3</dc:creator>
      <dc:date>2004-10-08T14:43:19Z</dc:date>
    </item>
  </channel>
</rss>

