how to use ftp(1) in batch mode

Jamie Landeg-Jones jamie at catflap.org
Sat Sep 1 12:26:19 UTC 2018


Wojciech Puchar <wojtek at puchar.net> wrote:

> thank you. it works. actually even without netrc
>
> (echo command1;echo command2)|ftp ftp://user:password@server/

If you need something slightly more robust, you may want to look
at lang/expect, which uses send/expect sequences similar to kermit
and uucp, but with more powerful options:

man expect(1):

 | Expect is a program that "talks" to other interactive programs according to a
 | script.  Following the script, Expect knows what can be expected from a program and
 | what the correct response should be.  An interpreted language provides branching and
 | high-level control structures to direct the dialogue.  In addition, the user can
 | take control and interact directly when desired, afterward returning control to the
 | script.

 cheers, Jamie


More information about the freebsd-hackers mailing list