【发布时间】:2015-06-15 09:41:11
【问题描述】:
我需要可以通过我的 sh 代码从 ftp 下载文件的脚本
我已经将expect 与 ftp 一起使用,但如果我在代码中使用 for 循环,我得到了
错误的#args:应该是“for start test next command” 在执行“a b c”中的“for v”时
我的代码
/usr/bin/expect << EXCEPT_SCRIPT
set timeout 1
spawn ftp -n ${HOST}
send "user ${USER} ${PASSWD}\n"
expect "ftp>"
send "bin\n"
expect "ftp>"
send "dir\n"
for v in "${files_to_download[@]}"
do
ftp_file="${v}.bz2"
#download file
echo ${ftp_file}
#put code to dl here
done
expect "ftp>"
send "bye\n"
EXCEPT_SCRIPT
【问题讨论】: