问题描述
- 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
"
expect {
timeout { exit 1 }
"assword:"
}
send "$login_pwd
"expect {
timeout { exit 1 }
"assword:" { exit 1 }
"ogin failed" { exit 1 }
"ftp>"
}
send "passive
"expect "ftp>"
send "lcd $localpath
"
expect "ftp>"
send "cd $remotepath
"expect {
timeout { exit 1 }
"ftp>"
}
#LJ
send "mget LJ*
"
expect {
timeout { exit 1 }
"ailed to open file" { exit 1 }
"ad sequence of command" { exit 1 }
"ftp>"
}
send "mdelete LJ*
"
expect {
timeout {exit 1}
"ailed to open file" {exit 1}
"ad sequence of command" { exit 1 }
"ftp>"
}
send "bye
"
exit 0
解决方案
http://blog.163.com/comfort_122/blog/static/48904409201062412045952/
解决方案二:
ftp 下载文件