Quote:
Originally Posted by cbtshare
I already gave you the script:
make the change on the local server:
on the local server
then the script is
|
It is not working see the error and updated script below.
===========
ERROR =
===========
can't read "WHEN": no such variable
while executing
"spawn "echo get $WHEN.log" | /usr/bin/sftp
Averda@gateway.rmmel.com"
(file "/home/mydesk/Desktop/1/sftp.exp" line 3)
===========
UPDATED SCRIPT =
===========
[as you explain I have given the command in local server first (export WHEN=`date +%m%d%y`)
then after I am running the script]
#!/usr/bin/expect
spawn "echo get $WHEN.log" | /usr/bin/sftp user@11.22.33.44
expect "user@11.22.33.44's password:"
send "abcdefg"
send "\r"
expect "sftp>"
send "ls \r"
expect "sftp>"
spawn "get $WHEN \r" (File name will change every day so I will have to give here variable name)
expect "sftp>"
send "bye \r"
============