The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 08:16 AM
Newb scripting question, I get the error script not found Arkitech Shell Programming and Scripting 3 05-04-2006 07:55 AM
difference between AIX shell scripting and Unix shell scripting. haroonec Shell Programming and Scripting 2 04-12-2006 05:12 AM
scripting guru's pls help me with scripting on AIX thatiprashant Shell Programming and Scripting 1 01-20-2006 04:58 PM
Error: Internal system error: Unable to initialize standard output file firkus UNIX for Dummies Questions & Answers 2 10-25-2005 12:23 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-07-2005
Registered User
 

Join Date: Jun 2005
Location: St. Louis, MO
Posts: 32
Error in scripting ftp

Good Morning,

I just would like to know what is wrong with my script. I am trying to use a for loop on my ftp command but the part that pipes the ftp information is reported in unix as error. Here's my script :

#!/bin/ksh
# other parts of the script here....

# get all ORD* files created and then ftp it to the other server...

cd $PRODATA
ORDDOWNLD=`ls ORD????.DLD`
# test data - ORDDOWNLD='ORD8705.DLD ORD8706.DLD ORD8707.DLD'

# then delete e_downso.txt
# Above file is the source of records for ORD files. Once #our system did not find the file "e_downso.txt", it will #generate another ORD file, which is ok because it will not #be part of the list....

# I could also add a logic to rename the ORD* files in the #list variable so that other process running this same script
# will not pick this file again.....



export ORDDOWNLD

for i in $ORDDOWNLD
do
# transfer ORD files one by one......
ftp -n -v wms > josephtest.log <<- !
user test test^M
cd done
put $i
get $i J$i
quit^M
!
# compare if ORD in WMS is equal to what is in GLOVIA...
diff $i J$i
# then test if there is difference,,,if none, then delete $i.....

# else send an email to helpdesk to inform users that part of $i was not copied to WMS...
done

#=================end of script=================================


After running above script, I am getting the following error :

/glo71sw/716/devl/userdata/scripts --> ./josephtest.k>
./josephtest.ksh[7]: syntax error at line 12 : `<<' unmatched
/glo71sw/716/devl/userdata/scripts -->


Please advise. Basically, our goal is to make sure the ORD file we ftp to the other server is the same copy as in our source server. The source of the ORD file is getting updated by many users that is why after getting the list of ORD* files,

Thank you very much!

Joseph
Reply With Quote
Forum Sponsor
  #2  
Old 06-07-2005
Registered User
 

Join Date: Jun 2005
Posts: 18
Joseph,

the "<<- !" in line 12 is basically the start of what gets sent to the ftp log. Right below the "quit" line you should have the terminating string to say when to stop sending the output to the ftp log. You have a single "!" instead of a "- !" that you have at line 12.

Scripts at my company usually use a *** as a starting and stopping point.

ftp -nv >> ftplog.log <<***
open user
get
put
quit
***

I do not think it matters what is used as long as it matches the string at the start.

;

Last edited by SemiOfCol; 06-07-2005 at 09:09 AM.
Reply With Quote
  #3  
Old 06-07-2005
Registered User
 

Join Date: Jun 2005
Location: St. Louis, MO
Posts: 32
Thanks SemiOfCol!

I will try it out...I thought the "-" is part of the "<<" command....I will replace the "!" with the EOF.

Joseph
Reply With Quote
  #4  
Old 06-07-2005
Registered User
 

Join Date: Jun 2005
Location: St. Louis, MO
Posts: 32
I am still getting the same error even after replacing "<<- !" and "!" with "<<EOF" and "EOF". Help!

Thanks!

Joseph
Reply With Quote
  #5  
Old 06-07-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
remove '^M' from your script - use dos2unix [if you have one]
[or vi/sed]
Reply With Quote
  #6  
Old 06-08-2005
Registered User
 

Join Date: Jun 2005
Location: St. Louis, MO
Posts: 32
Thanks!

I tried removing the "^M" but I am still getting the error.

Is it possible to run "ftp" inside a for loop like what I am doing? Please help..
Thanks!

Joseph
Reply With Quote
  #7  
Old 06-08-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,029
Quote:
Originally Posted by negixx
Thanks!

I tried removing the "^M" but I am still getting the error.

Is it possible to run "ftp" inside a for loop like what I am doing? Please help..
Thanks!

Joseph
pls post once again the code snippet exactly as it is and what you're seeing.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0