Re: [SLUG] Re: SFTP Help

From: Eben King (eben1@tampabay.rr.com)
Date: Wed Oct 12 2005 - 11:04:21 EDT


On Wed, 12 Oct 2005, Keith Lelacheur wrote:

> Finally got the thing working in a roundabout way. Maybe not the cleanest
> way to do it, but it works and folks are happy. I did not know where to
> begin with the "expect" scripting, but thanks to google I stumbled across
> "autoexpect" which seems to work like a macro recorder of sorts.

Eh, what you posted below looks pretty optimized.

> I used "autoexpect" and then sftp'd into the remote server entering the
> password manually. Once I was in the script that sftp called with the -b
> option was executed and I exited the ftp session. I exited the
> "autoexpect" shell and there was the script.exp file generated by
> autoexpect. I modified the script.exp for my purposes and then was able to
> call it from my main processing scripts, lo and behold the file was moved
> without manual intervention. For those at last nights Tampa meeting and
> anyone else interested, here is what the meat of the expect script ended
> up looking like:
>
> ..........
> set timeout -1
> spawn $env(SHELL)
> match_max 100000
> send -- "sftp -b sftppush username@69.*.*.*\r"
> expect "username@69.*.*.*'s password: "

You can change that to

expect "password: "

or

expect "'s password: "

so when/if the address of the destination machine changes, that part doesn't
break also.

> send -- "password\r"
> send -- "exit\r"
> expect eof
> ...........

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
CANCER:  The position of Jupiter says that you should spend the
rest of the week face down in the mud.  Try not to shove a roll of
duct tape up your nose when taking your driver's test.  -- Weird Al

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:12:37 EDT