#!/bin/ksh
. $HOME/bin/init.ksh
log_start
exit_if_not_dgftp
EXPIRE_DAYS=30
create_arc_dir
handle_error abort $? "Command create_arc_dir failed" $USER
purge_archive $EXPIRE_DAYS
WORK_FILE=RetriesExceeded.csv
[email protected]
HOST=lawsonfax.test.org
# Ftp the file
# Ftp username and password is in .netrc
$FTP -v $HOST
lcd $WORK_FILE
get RetriesExceeded.csv
quit
archive_file $WORK_FILE
# /law/bin/mpack -s "Fax Retries Exceeded" $WORK_FILE_OUTPUT $USER
log_stop
exit 0
错误:无法识别脚本的“获取”部分并向下。它正在通过连接工作。
[dgftp@lawapp2]/lawif/bin$ get_lawson_fax.ksh
Connected to lawsonfax.test.org.
220 Microsoft FTP Service
331 Password required for dgftp.
230 User logged in.
ftp> quit
221 Goodbye.
/lawif/bin/get_lawson_fax.ksh[33]: lcd: not found
/lawif/bin/get_lawson_fax.ksh[34]: get: not found
/lawif/bin/get_lawson_fax.ksh[35]: quit: not found
[dgftp@lawapp2]/lawif/bin$
我获取的文件位于 Windows 服务器上。
答案1
你应该能够使用这里的文件将命令传递到 ftp 会话的标准输入:
$FTP -v "$HOST" << EOF
lcd "$WORK_FILE"
get RetriesExceeded.csv
quit
EOF
该EOF
字符串可以被任意单词替换以表示输入的开始和结束。