FTP to SFTP conversion

Hi,
I have the following ftp code to check the status of communication channel :

/bin/ftp -i -v -n -B 64 $HOST <<END 2>&1 > $LOGFILE
user $user $password
bye
END

I need to re write exactly the same way with SFTP using authentication keys, I know how to do SFTP with authentication keys.

But my problem is, when the authentication fails, it asks for the password, which I dont want, else I need to write the error in the $LOGFILE.

Could you please explain me how to do it, without using script file for SFTP

Regards
Shihab

Please review our rules and note:
(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post or send a private message where your goal is to get an answer more quickly.

See http://ask-leo.com/how\_can\_i\_automate\_an\_sftp\_transfer\_between\_two_servers.html for a rather involved discussion.

I am really sorry.. the duplicate posting was by mistake.. I really dont know how it happened

Thanks awk , for the link, it gave me lot of information.
I have one more issue,
When I am trying to connect using sftp for the first time, it gives me error :

The authenticity of host can't be established
RSA key fingerprint is abd:adfasd
Are you sure you want to continue connecting (yes/no)?

now when I say yes, it connects and enters the entry in the known_hosts file.I dont want this to happen, as I need to automate every thing, without any user intervension. How is it possible?
I created a config file and connected with that
sftp -F /home/shihab/ssh_config user@IP
. still not working
also i tried with this also :
sftp -oCheckHostIP=yes -o HashKnownHosts=no user@IP

but no hope
am i wrong any where?
Can anybody help me.

Thanks
Shihab