Linux 下ftp命令问题。
#!/usr/bin/ksh#TestFTPdateVar=`date'+%Y%m%d'`FILE_PATH=/inc_report/inc/sysadm/clist;e...
#! /usr/bin/ksh
#Test FTP
dateVar=`date '+%Y%m%d'`
FILE_PATH=/inc_report/inc/sysadm/clist; export FILE_PATH
OTHER_FILE_NAME=CALL_OTHER_LIST_${dateVar}; export OTHER_FILE_NAME
if [ ! -r $FILE_PATH/$OTHER_FILE_NAME ]; then
echo "${FILE_PATH}/${OTHER_FILE_NAME} Can't copy to 192.168.40.44/u01"
else
echo "begin................."
ftp -n 192.168.40.44<<EOF
user oracle oracle
cd /u01
lcd $FILE_PATH
ascii
put $OTHER_FILE_NAME
bye
EOF
fi;
为何以上shell执行的时候报错??
0403-057 Syntax error at line 13 : `<' is not matched.
问题终于解决。。。
就因为EOF两边有空格所致!去掉空格之后运行正常。。。。。。。 展开
#Test FTP
dateVar=`date '+%Y%m%d'`
FILE_PATH=/inc_report/inc/sysadm/clist; export FILE_PATH
OTHER_FILE_NAME=CALL_OTHER_LIST_${dateVar}; export OTHER_FILE_NAME
if [ ! -r $FILE_PATH/$OTHER_FILE_NAME ]; then
echo "${FILE_PATH}/${OTHER_FILE_NAME} Can't copy to 192.168.40.44/u01"
else
echo "begin................."
ftp -n 192.168.40.44<<EOF
user oracle oracle
cd /u01
lcd $FILE_PATH
ascii
put $OTHER_FILE_NAME
bye
EOF
fi;
为何以上shell执行的时候报错??
0403-057 Syntax error at line 13 : `<' is not matched.
问题终于解决。。。
就因为EOF两边有空格所致!去掉空格之后运行正常。。。。。。。 展开
1个回答
展开全部
# $1 = Remote host
# $2 = Remote user
# $3 = Remote password
# $4 = Remote directory
ftp -n -i << EOF
open $1
user $2 $3
cd $4
ls
close
bye
EOF
# $1 = FTP host
# $2 = FTP user
# $3 = FTP password
# $4 = 1st directory/file name
# $5 = 2nd directory/file name
# $6 = get / put
ftp -n -i << EOF
open $1
user $2 $3
binary
$6 $4 $5
close
bye
EOF
# $2 = Remote user
# $3 = Remote password
# $4 = Remote directory
ftp -n -i << EOF
open $1
user $2 $3
cd $4
ls
close
bye
EOF
# $1 = FTP host
# $2 = FTP user
# $3 = FTP password
# $4 = 1st directory/file name
# $5 = 2nd directory/file name
# $6 = get / put
ftp -n -i << EOF
open $1
user $2 $3
binary
$6 $4 $5
close
bye
EOF
更多追问追答
追问
# $4 = 1st directory/file name
# $5 = 2nd directory/file name
# $6 = get / put
$6 $4 $5 这句意思是把$4复制到$5吗?
若 $4来自服务器A
$5是服务器B
$6 $4 $5也可以直接用么?
追答
我这里是传过来的参数,可以替换掉啊
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |