I am working on a fairly simple shell script to ftp some files from a remote Windows 2003server to a Suse 9.2 Pro linux server. The remote files are web log files and are stored with the date as part of the file name. I want my shell script to ftp a copy of the file with yesterday's date. Here is the shell script i have so far:
yesterday=$(TZ=EST26EDT date +%d-%m-%y)
ftp -n server.ourdomain.com << "EOF"
quote user username
quote pass password
here are the results i reveive when i try to manually run the script:
CorpDev:~/scripts # sh ftp.sh
Connected to server.ourdomain.com.
220 Microsoft FTP Service
331 Password required for username.
230 User username logged in.
250 CWD command successful.
Local directory now /usr/local/awstats/ftp_fil
local: $file remote: $file
500 'EPSV': command not understood
227 Entering Passive Mode (10,1,1,75,5,86).
550 $file: The system cannot find the file specified.
while 'echo $file' shows the proper format for my log file, my get $file command in the list of ftp commands does not translate $file to server_access_log.23-05-06
.log. What am i missing that I am unable to use the variable substitution in my script.
Thanks in advance,