Unattended ftp to Solaris

I have a Red Hat 9 server which I am attempting to ftp a file to
a Solaris 8 server using a shell script to perform an unattended ftp. I have the following script setup to run:

#!/bin/sh
#
cd /tmp
ftp -v 192.20.20.5 << EOF 2>&1
cd /tmp
put gatherstats
bye
EOF

I created the .netrc file on the Linux server to access the Solaris server. When I run my shell script it hangs on the Linux server. Any help would be appreciated.

Thanks,

Mike

you can try

ftp -n 192.20.20.5 <<!
user "user_name" "user_password"
cd /tmp
put gatherstats
bye
!

Note
"user_name" is the users ftp name and "user_password" users password

This method works but it is not secure, A secure
way of having secure ftp through script is to use
sftp. you need to install ssh and then export the
public key, this way you will be able to use sftp without the need to have passwords in script.