FTP Command inside If condition

Hi All,

I am facing a alien problem in unix shell script.
i have a requirement where i have to check first whether a particular file has been created or not if that file has been created then that file needs to be ftped to a particular dir.
My Code is like that

Success='code for file creation which return OK or NOTOK'

if [ "$Success" == "OK" ]; then

ftp -inv<<EOF
open 00.00.00.00 
user $username $password
cd /home/unix
ascii 
put <file name>
bye
EOF
fi

Now when i execute this statement it gives me syntax error "at line number xyz: '<' is not matched"

When i remover one < from my code "ftp inv<EOF" then it gives me an error
"at line number xxx: 'then' is not matched"

When i am putting this ftp command outside the if condition it is working fine.

Kindly help me out.

Thanks
Aryan

Make sure there are no spaces before the last EOF.
Perhapes, you can write a function for the ftp and then call that function from the IF loop.

I also suspect the same , make sure is there any space before EOF.
try giving a semicolon before a first EOF

ex : <<EOF ;

Hi All,

Thanks for your help. i have got the solution. Actually there was some space just before the FTP command due to which it was not working.

Thanks
Aryan