You may want to check out the "lftp" client. Lftp will accept FTP commands via a file, including the password.
From: Linux on 390 Port [mailto:LINUX-390@VM.M...] On Behalf Of Eddie Chen
Sent: Thursday, July 12, 2012 5:22 PM
To: LINUX-390@VM.M... Subject: EXTERNAL: Running SecureFTP in background mode using perl "expect"
I have a perl script that issue SecureFTP(sftp) to automate the file transfer and the password prompt.
When the script runs in the foreground, it works, and it takes the password.
[echen@startnet11 ~]$ ksh EDC.ksh Eddie.cmd
sftp> put zvm.note zvm.note
Uploading zvm.note to /users/nyse/zvm.note
sftp> ls -l zvm.note
-rwxr-x--- 0 0 0 667 Jul 12 19:08 zvm.note
Note: The input file "Eddie.cmd" contains the userid and password.
When I run the script in background, the password prompts comes back to my terminal and not to the script.
Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext.