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.


Alternative #1

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.

Via.  Using ftp in a shell script

參考這個,寫成upload的 shell指令。原本想用ncftpput的,不過看似用在零壹出的這台設備有問題!?某些指令無法正常運作導致上傳失敗。