<?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 question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851861#M395232</link>
    <description>&lt;!--!*#--&gt;Hello Geoff,&lt;BR /&gt;&lt;BR /&gt;This posting was awhile ago. Not sure if it still stands true or there is a better method.&lt;BR /&gt;&lt;BR /&gt;We also have the same SFTP script which uses Expect. &lt;BR /&gt;&lt;BR /&gt;I see in the responses you resolved this yourself chalking it up to PEBKAC.&lt;BR /&gt;&lt;BR /&gt;Not sure if I understand you answer about&lt;BR /&gt;"&lt;BR /&gt;  The user was double sourcing their .kshrc file - when I removed it - script worked fine. "&lt;BR /&gt;&lt;BR /&gt;Can you explain  ?&lt;BR /&gt;&lt;BR /&gt;Also , is there a reason why you chose Expect to script the SFTP , other than this is a canned SFTP script and why re-invent the wheel thinking. &lt;BR /&gt;&lt;BR /&gt;Thanks &lt;BR /&gt;&lt;BR /&gt;Paul&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 24 Apr 2007 10:50:57 GMT</pubDate>
    <dc:creator>Paul Johnston_4</dc:creator>
    <dc:date>2007-04-24T10:50:57Z</dc:date>
    <item>
      <title>Expect question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851855#M395226</link>
      <description>One of my users is using an expect script to sftp a file offsite automatically.&lt;BR /&gt;&lt;BR /&gt;Unfortunately, it doesn't work.&lt;BR /&gt;&lt;BR /&gt;Here's the script:&lt;BR /&gt;&lt;BR /&gt;#!/usr/local/bin/expect -f&lt;BR /&gt;#&lt;BR /&gt;# This Expect script was generated by autoexpect on Wed Dec 10 08:04:14 2003&lt;BR /&gt;# Expect and autoexpect were both written by Don Libes, NIST.&lt;BR /&gt;#&lt;BR /&gt;# Note that autoexpect does not guarantee a working script.  It&lt;BR /&gt;# necessarily has to guess about certain things.  Two reasons a script&lt;BR /&gt;# might fail are:&lt;BR /&gt;#&lt;BR /&gt;# 1) timing - A surprising number of programs (rn, ksh, zsh, telnet,&lt;BR /&gt;# etc.) and devices discard or ignore keystrokes that arrive "too&lt;BR /&gt;# quickly" after prompts.  If you find your new script hanging up at&lt;BR /&gt;# one spot, try adding a short sleep just before the previous send.&lt;BR /&gt;# Setting "force_conservative" to 1 (see below) makes Expect do this&lt;BR /&gt;# automatically - pausing briefly before sending each character.  This&lt;BR /&gt;# pacifies every program I know of.  The -c flag makes the script do&lt;BR /&gt;# this in the first place.  The -C flag allows you to define a&lt;BR /&gt;# character to toggle this mode off and on.&lt;BR /&gt;&lt;BR /&gt;set force_conservative 1  ;# set to 1 to force conservative mode even if&lt;BR /&gt;                          ;# script wasn't run conservatively originally&lt;BR /&gt;if {$force_conservative} {&lt;BR /&gt;        set send_slow {1 .1}&lt;BR /&gt;        proc send {ignore arg} {&lt;BR /&gt;                sleep .1&lt;BR /&gt;                exp_send -s -- $arg&lt;BR /&gt;        }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;# 2) differing output - Some programs produce different output each time&lt;BR /&gt;# they run.  The "date" command is an obvious example.  Another is&lt;BR /&gt;# ftp, if it produces throughput statistics at the end of a file&lt;BR /&gt;# transfer.  If this causes a problem, delete these patterns or replace&lt;BR /&gt;# them with wildcards.  An alternative is to use the -p flag (for&lt;BR /&gt;# "prompt") which makes Expect only look for the last line of output&lt;BR /&gt;# (i.e., the prompt).  The -P flag allows you to define a character to&lt;BR /&gt;# toggle this mode off and on.&lt;BR /&gt;#&lt;BR /&gt;# Read the man page for more info.&lt;BR /&gt;#&lt;BR /&gt;# -Don&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;set timeout -1&lt;BR /&gt;spawn sftp -v test.user1@sshtest.somewhere.com:mydir/&lt;BR /&gt;match_max 100000&lt;BR /&gt;expect -exact "test.user1@sshtest.somewhere.com's password: "&lt;BR /&gt;send -- "mypass\r"&lt;BR /&gt;expect eof&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;On the screen, it just sit's there at the spawn line...&lt;BR /&gt;&lt;BR /&gt;From the command line, the sftp works...&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Jan 2004 15:36:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851855#M395226</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2004-01-06T15:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Expect question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851856#M395227</link>
      <description>Hi Geoff,&lt;BR /&gt;&lt;BR /&gt;Here is something we use to pass a password to expect, without having to look. It is used for a startup program. I have slightly changed it to protect what we actually use it for, but still should work.&lt;BR /&gt;Cheers&lt;BR /&gt;Michael&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Jan 2004 15:49:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851856#M395227</guid>
      <dc:creator>Michael Tully</dc:creator>
      <dc:date>2004-01-06T15:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Expect question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851857#M395228</link>
      <description>Well - chalk this up to PEBKAC - problem exists between keyboard and chair.  The user was double sourcing their .kshrc file - when I removed it - script worked fine.&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Jan 2004 10:59:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851857#M395228</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2004-01-07T10:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Expect question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851858#M395229</link>
      <description>Run your expect with &lt;BR /&gt;#!/usr/local/bin/expect -d&lt;BR /&gt;&lt;BR /&gt;With this it runs in debug, this sends all output to the screen, you can see all send and how and when the expect script rejected it.  &lt;BR /&gt;</description>
      <pubDate>Wed, 07 Jan 2004 14:32:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851858#M395229</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2004-01-07T14:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Expect question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851859#M395230</link>
      <description>You may also want to remove the expect -exact to expect "blah$" and anchor the end of the line.&lt;BR /&gt;&lt;BR /&gt;I have spent many nights troubleshooting expect scripts.</description>
      <pubDate>Wed, 07 Jan 2004 14:34:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851859#M395230</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2004-01-07T14:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Expect question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851860#M395231</link>
      <description>What I would recommend doing is having your user re-create the script using autoexpect.  autoexpect will allow your user to log into the session one time and autoexpect will record everything into a file which will be used for the script then.  after run all you need to do is pull out a few extraneous lines.  the syntax for this is &lt;BR /&gt;autoexpect -f &lt;FILENAME&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Wed, 07 Jan 2004 15:00:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851860#M395231</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2004-01-07T15:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Expect question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851861#M395232</link>
      <description>&lt;!--!*#--&gt;Hello Geoff,&lt;BR /&gt;&lt;BR /&gt;This posting was awhile ago. Not sure if it still stands true or there is a better method.&lt;BR /&gt;&lt;BR /&gt;We also have the same SFTP script which uses Expect. &lt;BR /&gt;&lt;BR /&gt;I see in the responses you resolved this yourself chalking it up to PEBKAC.&lt;BR /&gt;&lt;BR /&gt;Not sure if I understand you answer about&lt;BR /&gt;"&lt;BR /&gt;  The user was double sourcing their .kshrc file - when I removed it - script worked fine. "&lt;BR /&gt;&lt;BR /&gt;Can you explain  ?&lt;BR /&gt;&lt;BR /&gt;Also , is there a reason why you chose Expect to script the SFTP , other than this is a canned SFTP script and why re-invent the wheel thinking. &lt;BR /&gt;&lt;BR /&gt;Thanks &lt;BR /&gt;&lt;BR /&gt;Paul&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Apr 2007 10:50:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851861#M395232</guid>
      <dc:creator>Paul Johnston_4</dc:creator>
      <dc:date>2007-04-24T10:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Expect question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851862#M395233</link>
      <description>Script was written by the users - so they didn't want it changed - they were sourcing their profile from another script prior to launching this one - when it was already sourced.</description>
      <pubDate>Thu, 31 May 2007 09:52:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/expect-question/m-p/4851862#M395233</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-05-31T09:52:52Z</dc:date>
    </item>
  </channel>
</rss>

