how to give sftp a password in a shell scripit

I want to write an sftp script, but I can't put ssh keys on my destination. Is it possible to pass sftp a password inside a script? I know that the -b option makes sftp use a file for params. Can the password go in such a file? How can I do this? Thanks in advance

You should really use keys for stuff like this.

However if you must put the password in a script, use Net::SFTP (i.e. Perl).

Cheers
ZB

Thanks for the reply, ZB. However, is there a way to do it without using Perl?

Yes, generate keys. Use ssh-keygen to create your keys (with an empty passphrase), then copy your public key into ~/.ssh/authorized_keys. Or (more secure), use a passphrase and some kind of keychain.

Cheers
ZB