Solaris shell 脚本
我正在编写一个脚本来使用一些规则来 ftp 一些文件。但我在创建 ftp 会话脚本时遇到问题。
下面是我现在正在使用的 shell 脚本。
#!/bin/bash
cd /var/ericsson/nin/charging/archive
date=`(/usr/bin/perl -e '($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time()-24*60*60);printf "%4d%02d%02d", $year+1900,$mon+1,$mday;')`
movedFile=`ls | grep $date`
HOST=xxxx
USER=xxxx
PASSWD=xxxxx
for i in $movedFile;
do
echo $date >> trial.txt
echo "Uploading file $i" >> trial.txt
ftp -n $HOST
quote USER $USER
quote PASS $PASSWD
binary
cd TEMP
put $i
quit
END_SCRIPT
echo "kk"
done
问题是。无法触发ftp的引用命令。
I am writing a script to ftp some files using some rules. But I have problems with the scripts ftp session creation.
below is the shell script I am using right now.
#!/bin/bash
cd /var/ericsson/nin/charging/archive
date=`(/usr/bin/perl -e '($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time()-24*60*60);printf "%4d%02d%02d", $year+1900,$mon+1,$mday;')`
movedFile=`ls | grep $date`
HOST=xxxx
USER=xxxx
PASSWD=xxxxx
for i in $movedFile;
do
echo $date >> trial.txt
echo "Uploading file $i" >> trial.txt
ftp -n $HOST
quote USER $USER
quote PASS $PASSWD
binary
cd TEMP
put $i
quit
END_SCRIPT
echo "kk"
done
the problem is. It is unable to trigger quote commands of ftp.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看bash 此处文档。您正在寻找的语法是:
Check out bash Here Documents. The syntax you're looking for is:
因为评论里看不到。这是正确的答案适用于我的情况
since it is unable to be seen in the comments. here is the correct answer worked my situation