Guest_imported
New member
- Jan 1, 1970
- 0
- 0
- 0
Hi,
I have tried the AIX FTP KornShell script without using the function, and it worked, but whenItried to use function for my my script which did not work.
For example, when Iissued the ftp command :ftp -v -i 111.11.111.112 > ftp${site}_out << ENDFTP" in my script,it showed the message "cftp.sh[13]: 0403-057 Syntax error at line 21 : `<' is not matched.".So Ichanged the ftp command to:ftp -v -i 140.90.154.135 > ftp${site}_out \<\< ENDFTP.(Change from << to \<\<) It still did not work neither.
Thank you for any assistance.
Below is my AIX FTP Korn Shell script:
+1#! /bin/ksh
+2# File: cftp.sh
+3# FTP FUNCTIONS #
+4
+5function LAST_MAX_LINE_FILE {
+6typeset MAXLINE=60
+7#typeset MAXLINE=6000
+8tail -$MAXLINE $logfile > tempFile
+9mv tempFile $logfile
+10return 0
+11}
+12
+13function myftp {
+14typeset rhost=${1}
+15typeset remote=${2}
+16typeset line=$3
+17typeset site=${4}
+18#typeset MAXLINE=60
+19
+20
+21ftp -v -i 140.90.154.135 > ftp${site}_out << ENDFTP
+22
+23cd $remote
+24lcd /home/cindyc/ftp/get_files
+25type binary
+26
+27dir
+28mget *
+29quit
+30ENDFTP
+31
+32logfile=/home/cindyc/ftp/logs/${site}.LOG_`date +%m +%d`
+33
+34echo "***************************** `date +%d` `date +%b` `date
+35+%Y` `date +%T` NOS_server Line: $line" >> $logfile
+36
+37cat ftp${site}_out >> $logfile
+38
+39LAST_MAX_LINE_FILE
+40return 0
+41}+42
+43
+44# MAIN BODY OF SCRIPT #
+45MAXLINE=30
+46#MAXLINE=3000
+47
+48#find /home/cindyc/ftp/logs/ -mtime +2 -exec rm {} \;
+49
+50sbLog=/home/cindyc/ftp/logs/ftpsb.LOG_`date +%m +%d`
+51
+52# FTP NOS#
+53
+54echo "`date +%D` `date +%T ` NOS ftp starting..." >> $sbLog
+55
+56myftp 111.11.111.112 /test/dir 75 NOS
+57
+58echo "`date +%D` `date +%T` NOS ftp completed." >> $sbLog
+59
+60# FTP FNM #
+61echo "`date +%D` `date +%T` FNM ftp starting..." >> $sbLog
+62
+63myftp 111.11.111.112 /test2/dir 77 FNM
+64
+65echo "`date +%D` `date +%T` FNM ftp completed." >> $sbLog
+66
+67# FTP HADS #
+68echo "`date +%D` `date +%T` HADS ftp starting..." >> $sbLog
+69
+70myftp 111.11.111.112 /test3/dir 78 HADS
+71
+72echo "`date +%D` `date +%T` HADS ftp completed." >> $sbLog
+73
+74LAST_MAX_LINE_FILE
+75
+76# c_mode_program /home/cindyc/get_files/*
+77
I have tried the AIX FTP KornShell script without using the function, and it worked, but whenItried to use function for my my script which did not work.
For example, when Iissued the ftp command :ftp -v -i 111.11.111.112 > ftp${site}_out << ENDFTP" in my script,it showed the message "cftp.sh[13]: 0403-057 Syntax error at line 21 : `<' is not matched.".So Ichanged the ftp command to:ftp -v -i 140.90.154.135 > ftp${site}_out \<\< ENDFTP.(Change from << to \<\<) It still did not work neither.
Thank you for any assistance.
Below is my AIX FTP Korn Shell script:
+1#! /bin/ksh
+2# File: cftp.sh
+3# FTP FUNCTIONS #
+4
+5function LAST_MAX_LINE_FILE {
+6typeset MAXLINE=60
+7#typeset MAXLINE=6000
+8tail -$MAXLINE $logfile > tempFile
+9mv tempFile $logfile
+10return 0
+11}
+12
+13function myftp {
+14typeset rhost=${1}
+15typeset remote=${2}
+16typeset line=$3
+17typeset site=${4}
+18#typeset MAXLINE=60
+19
+20
+21ftp -v -i 140.90.154.135 > ftp${site}_out << ENDFTP
+22
+23cd $remote
+24lcd /home/cindyc/ftp/get_files
+25type binary
+26
+27dir
+28mget *
+29quit
+30ENDFTP
+31
+32logfile=/home/cindyc/ftp/logs/${site}.LOG_`date +%m +%d`
+33
+34echo "***************************** `date +%d` `date +%b` `date
+35+%Y` `date +%T` NOS_server Line: $line" >> $logfile
+36
+37cat ftp${site}_out >> $logfile
+38
+39LAST_MAX_LINE_FILE
+40return 0
+41}+42
+43
+44# MAIN BODY OF SCRIPT #
+45MAXLINE=30
+46#MAXLINE=3000
+47
+48#find /home/cindyc/ftp/logs/ -mtime +2 -exec rm {} \;
+49
+50sbLog=/home/cindyc/ftp/logs/ftpsb.LOG_`date +%m +%d`
+51
+52# FTP NOS#
+53
+54echo "`date +%D` `date +%T ` NOS ftp starting..." >> $sbLog
+55
+56myftp 111.11.111.112 /test/dir 75 NOS
+57
+58echo "`date +%D` `date +%T` NOS ftp completed." >> $sbLog
+59
+60# FTP FNM #
+61echo "`date +%D` `date +%T` FNM ftp starting..." >> $sbLog
+62
+63myftp 111.11.111.112 /test2/dir 77 FNM
+64
+65echo "`date +%D` `date +%T` FNM ftp completed." >> $sbLog
+66
+67# FTP HADS #
+68echo "`date +%D` `date +%T` HADS ftp starting..." >> $sbLog
+69
+70myftp 111.11.111.112 /test3/dir 78 HADS
+71
+72echo "`date +%D` `date +%T` HADS ftp completed." >> $sbLog
+73
+74LAST_MAX_LINE_FILE
+75
+76# c_mode_program /home/cindyc/get_files/*
+77