2 notnullto32 NotNullTo32 于 2015.07.13 15:08 提问

expect ftp 下载文件文件损坏,写法如下,

#!/bin/expect
set timeout 30
set host 10.9.9.145
set login_name zzz
set login_pwd zzz
set localpath "/home/acc/songt/read"

set remotepath "/home/acc/songt/write"

spawn -noecho ftp -i $host

expect {
timeout { exit 1 }
"ame"
}
send "$login_name\r"
expect {
timeout { exit 1 }
"assword:"
}
send "$login_pwd\r"

expect {
timeout { exit 1 }
"assword:" { exit 1 }
"ogin failed" { exit 1 }
"ftp>"
}
send "passive\r"

expect "ftp>"
send "lcd $localpath\r"
expect "ftp>"
send "cd $remotepath\r"

expect {
timeout { exit 1 }
"ftp>"
}
#LJ
send "mget LJ*\r"
expect {
timeout { exit 1 }
"ailed to open file" { exit 1 }
"ad sequence of command" { exit 1 }
"ftp>"
}
send "mdelete LJ*\r"
expect {
timeout {exit 1}
"ailed to open file" {exit 1}
"ad sequence of command" { exit 1 }
"ftp>"
}
send "bye\r"
exit 0

2个回答

caozhy
caozhy   Ds   Rxr 2015.07.14 05:52
CSDNXIAON
CSDNXIAON   2015.07.16 22:13

ftp 下载文件
----------------------同志你好,我是CSDN问答机器人小N,奉组织之命为你提供参考答案,编程尚未成功,同志仍需努力!

Csdn user default icon
上传中...
上传图片
插入图片