end of file error bash ftp script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting end of file error bash ftp script
# 1  
Old 01-18-2011
Question end of file error bash ftp script

Hello kind programmers Smilie

I am a newbie and running into an error "line 28: syntax error: unexpected end of file" on the script shown below. Any help would be greatly appreciated. Thanks!
Code:
#! /bin/bash

if ($#argv <3) then 
 echo 'Usage get_modis_snow [yyyy] [mm] [dd] [tile]'
 echo 'ftp script for MYD10A2 8-day, 500-m snow'
 echo 'example: get_modis_snow 2006 01 01 h08v05' 
 exit
endif

set yyyy="$1"
set mm="$2"
set dd="$3"
set tile="$4"

target=/desired_folder/

USER="anonymous"
PASS="email_address"

ftp -inv n4ftl01u.ecs.nasa.gov<<ENDFTP
user $USER $PASS
cd /SAN/MOSA/MYD10A2.005/$yyyy.$mm.$dd
put MYD10A2.A$yyyy.$tile.?????????????.hdf>>$target
bye
ENDFTP

exit 0

Thanks in advance!
Cheney

Last edited by Franklin52; 01-19-2011 at 03:26 AM.. Reason: Please use code tags
# 2  
Old 01-18-2011
Your mixing csh keywords like endif with bash keywords which should be fi in your case. Plus your using set instead of yyyy="$1" etc...

The script might actually work just by changing the shell to csh in the top line:

Code:
 
#!/bin/csh

# 3  
Old 01-19-2011
Bug thanks!

Thank you simusphere Smilie Changing to csh worked. I appreciate your help!!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. BSD

Keep getting error "-bash: ./.profile_z2: line 52: syntax error: unexpected end of file"

#!/bin/bash #-------------------------------------------------------- # Setup prompt # Author Zeeshan Mirza # Data: 06-08-2017 #-------------------------------------------------------- if then . ./.profile_custom_pre fi umask 022 set -o vi export EDITOR=vi export VISUAL=vi... (3 Replies)
Discussion started by: getzeeshan
3 Replies

2. Shell Programming and Scripting

With script bash, read file line per line starting at the end

Hello, I'm works on Ubuntu server My goal : I would like to read file line per line, but i want to started at the end of file. Currently, I use instructions : while read line; do COMMAND done < /var/log/apache2/access.log But, the first line, i don't want this. The file is long... (5 Replies)
Discussion started by: Fuziion
5 Replies

3. Shell Programming and Scripting

Ftp bash script appends to file using cron instead of coping new file

I have a bash script that is running a mysql query and creating a csv file with a time stamp. It then uploads that to a ftp server. Everything works great when I manually run it. But then I have a cron job set to run every monday, wednesday and friday at 5am est. When the cron job runs, it... (7 Replies)
Discussion started by: akallenberger
7 Replies

4. Shell Programming and Scripting

Help with FTP Script which is causing "syntax error: unexpected end of file" Error

Hi All, Please hav a look at the below peice of script and let me know if there are any syntax errors. i found that the below peice of Script is causing issue. when i use SFTP its working fine, but there is a demand to use FTP only. please find below code and explain if anything is wrong... (1 Reply)
Discussion started by: mahi_mayu069
1 Replies

5. Shell Programming and Scripting

Bash script puts \r at the end of variable

I'm pretty new to bash scripts and I'm trying to work through some issues. Would appreciate any suggestions. I have a list of servers in a text file (I used the FQDN's), I assign the file name to a variable, I then use cat to read the list of file names and echo them to the screen. But when it... (2 Replies)
Discussion started by: westmoreland
2 Replies

6. Shell Programming and Scripting

Cannot execute/finish script because of last line syntax error: unexpected end of file/token `done'

first of all I thought the argument DONE is necessary for all scripts that have or begin with do statements which I have on my script, However, I still don't completely understand why I am receiving an error I tried adding another done argument statement but didn't do any good. I appreciate... (3 Replies)
Discussion started by: wolf@=NK
3 Replies

7. Shell Programming and Scripting

Bash script for new file in ftp folder

Hello, I'm trying to make a bash script that send me e-mail if there is any new file in my ftp folder. cat inotify.sh #!/bin/sh /usr/bin/inotifywait -e create \ -mrq /home/mrowcp | while read line; do echo -n "$line " >> /var/log/inotify.log echo `date | cut -d " " -f1-4` >>... (3 Replies)
Discussion started by: mrowcp
3 Replies

8. Shell Programming and Scripting

FTP script error in BASH

Hi All, I have a script which is supposed to connect to Windows machine and FTP a file into LINUX. Script is like below #!/usr/bin/sh ParamterFle=${1} //grepping all parameters BossFtpLog=${2} // assigning log file ftp -i -n host_name << EOF user1 password1 cd /drive1/drive2 get... (6 Replies)
Discussion started by: Raamc
6 Replies

9. Shell Programming and Scripting

script syntax error: unexpected end of file

Need help. I cannot find the reason for this error: here is the script (6 Replies)
Discussion started by: Lenora2009
6 Replies

10. Shell Programming and Scripting

Help on shell script : syntax error at line 62: `end of file' unexpected

Hi All, I have written a korn script (code pasted below). It is giving the error while debugging "new.sh: syntax error at line 62: `end of file' unexpected". I have re-written the whole code in VI and explored all help related to this error on this Unix forum and tried it. Somehow, I could... (7 Replies)
Discussion started by: schandrakar1
7 Replies
Login or Register to Ask a Question