What is wrong with this script?

Hi,

Basically, i am reading a file and transferring files between two servers using sftp. I am checking the last character of the file which gives me the server number to transfer the file to..After i check the server number and try to include the sftp code....it gives me am error

syntax error: unexpected end of file....

This happens when ever i put sftp $host << EOF

Not sure where i am going wrong here....

I am attaching the script file

Can anyone help me with this

Thanks in adv

The biggest thing I see wrong with it is you haven't picked one language to do it in. Seems to be a mixture of C++, sh, and/or others.

Care to enlighten me on what language it is?
Post your OS and version too.
As far as these lines go, they should work as long as /home/ravala/test already exist (tested by themselves in ksh on Solaris 2.6).

sftp x.xxx.xxx.xx << EOF
mkdir /home/ravala/test/test1
quit
EOF

hi,

i am doing this using bash script..

yes the sftp code works if run independently....

the problem is whenever it is included in the loop it gives me that error.

So tell me, what is a comment in bash? I thought it was #.

You have the following...

// code for getting $strlen1

Isnt' that a comment in C++? I get an error if I add it to the script.

And you have
declare -a input
declare -a fileinput

(edited - as you can tell, I've never used bash - I thought the declare statements were also a C or C++ thing. My apologies).

How are you starting this (since you don't include the #!/path/bash in the start of the script)?

Try commenting out the sftp lines and put in a echo "I got to the sftp lines" - run your script - see if you still get the error because I don't know what you have in those other files that you are reading...so it makes it harder for me to quickly find what's wrong with the script. I've gotten into the second while but can't run your code.

Hey,

I am sorry.
// code is something i wanted to know that i have some code here... i did not want to dump the entire thing...

To be frank, i am new to scripting....

As , i told u...if i comment out the sftp code...everything works fine...but as soon as i add the sftp part it gives me the error...

i am assuming that there shud be something in the loops that is giving me the error...probably i am not looping properly....

i am basically looping thru the entries in 2 files

i declared the values to get the entries from a file into an array....

as i told if i include sftp ------ <<EOF, it gives me error

Hey,

Got my script working....Was something to do with loops...

Created a fresh script and it worked fine...

Thanks for the help