why not use .netrc?
man netrc
you specify login details and it automates for you.
make sure you chmod 600 .netrc first.
you can have macros to do commands too,
something like this:
Code:
machine blah.com
user terrence
password letmein
macdef init
hash
bin
cd /pub
get file.txt
<blank line>
so if you
ftp blah.com it will log on and do the init macro