I just wrote
echo "open $mainframe\
\nuser $mf_username $mf_password
\nsite lr=160\
\ncd ..\
\nmput \*\
\nquit" | ftp -i -n -v > $ftp_log 2>&1
The program collected data from the telephone company's Nortel MD110 switches, tidied it up and sent it to their mainframes.