Instead of using the build_script I used $env() instead. The environment
variables are case sensitive


spawn sftp "$env(user)@$env(host)"
expect {
default {exit 1}
"Connecting to sft.wellsfargo.com..."
}
expect {
default {exit 2}
"continue connecting (yes/no)?" {send "yes\n"; exp_continue}
"assword:"
}
send "$env(password)\n"
expect {
default {exit 3}
"sftp>"
}
send "put $env(filename)\n"
expect {
default {exit 4}
"not found" {exit 5}
"Uploading"
}
expect {
default {exit 6}
"sftp>"
}
send "quit\n"
exit 0



Marshall Akins
Vice President, Information Services
Hanna Steel Corporation
205-783-8265



From:
"Lim Hock-Chai" <Lim.Hock-Chai@xxxxxxxxxxxxxxx>
To:
<midrange-l@xxxxxxxxxxxx>
Date:
06/25/2009 02:13 PM
Subject:
Re: using expect script to do sftp
Sent by:
midrange-l-bounces@xxxxxxxxxxxx



Scott,
I'm not much of a unix person.

I did the following and try it again and still getting the same error:

1) unpack the tar file:
cd /home/palhc/expectScript
tar -xvf ./expect.5.43.tar

2) Change the last line of this script
http://code.midrange.com/d585dbe59e.html
From : build_script | /home/palhc/expectScript/expect.5.43.tar -f -
To : build_script | /home/palhc/expectScript/usr/local/bin/expect -f -

When I run the CL program I get:
/home/palhc/sftp819.sh: /home/palhc/expectScript/usr/local/bin/expect:
0403-006 Execute permission denied.





"Scott Klement" <midrange-l@xxxxxxxxxxxxxxxx> wrote in message
news:<mailman.14420.1245950581.23468.midrange-l@xxxxxxxxxxxx>...
Hello,

A tar file is an archive file. It's like a SAVF. Or a ZIP file.
That
sort of thing. You can't *run* a tar file.

You need to unpack/install the contents of the TAR file. i.e. restore

the contents of the archive. Then, you can run the stuff that was
inside it.


hockchai Lim wrote:
I'm having some problem executing a shell script that uses Expect
script to
do sftp by user ID and password and hope that someone here can help
me with
it. When I execute the script I get the following error:
/home/palhc/sftp819.sh: /home/palhc/expectScript/expect.5.43.tar:
0403-006
Execute permission denied.


Here is what I did:
1) Installed the OpenSSH.
2) Download Expect tool from http://www.scottklement.com/expect/ and

uncompress.
3) Create a script that looks like this:
http://code.midrange.com/d585dbe59e.html
4) My CL to execute the script looks like this:
http://code.midrange.com/78ef308dcc.html

thanks





As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.