Chapter 25. Going further with here documents

We have already met here (redirection) documents a few times when we dealt with standard input and output and while loops. We learnt how to send mail and how to construct a menu screen, but there are also other uses for here documents.

In this chapter we will cover:

  • creating a quick file;

  • automatically navigating menus;

  • ftp transfers; and

  • connecting to other application systems.

The format for a here document is:

command <<word text word 

To recap on here documents, this is how they work. When the shell sees the <<,it knows the next word is a delimiter (word). Anything after the word it treats as input until it sees the word again on a line by itself. The delimiter word can be any word you like.

You ...

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.