Or use a
here document:
Code:
ftp -ni ftp.address.or.ip << EOF 1> $HOME/ftp.log 2> $HOME/ftp.err
user username password
binary
put file
bye
EOF
Another tool that has much more flexibility than the standard ftp client is
lftp. In this case you can use a subshell to generate the commands and pipe them to lftp:
Code:
(
echo open ftp.address.or.ip
echo user username password
echo binary
echo put file
echo bye
) | lftp -f /dev/stdin