O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required