25.4. Automating ftp transfers

One popular use of here documents is to automate ftp transfers. When using ftp, it’s nice to give the users a simple interface to work with. The following script uses the username anonymous to make an ftp connection. This is a special username that enables systems to create security-based ftp accounts that hold public directories. Generally speaking, everybody who connects with an anonymous username can only download files from that public directory, but it can be set to upload files.

The password can be anything, but it’s considered good practice to use your hostname and your local userid or e-mail address.

The script that is presented here prompts for the following information:

  1. Remote machine you wish to connect ...

Get Linux and Unix Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.