Control of ftp by a shell script
One obvious improvement would have the ftp client program controlled by the shell script. I don’t think that would comprise an impossible task, but I also don’t think that it would have much value. Scripting ftp transfer using expectmight cause you less pain.
I saw a second way of doing this in a usenet article:
#!/bin/sh USER=userid PASSWD=userpw ftp -n f2dev <<SCRIPT user $USER $PASSWD binary get some.file quit SCRIPT
It still uses the “-n” trick, but it sends user ID and password in the same “user” command.