CHAPTER 28Free-Format Output Using cat

There are many ways to send script output to the screen or to a file. The technique demonstrated in this chapter for creating preformatted output is simple to code. Many times I have coded scripts that write entries to a log, create a configuration file, or generate formatted usage output one line at a time by redirecting the output of echo statements. This works perfectly well, but the code looks a bit ugly and becomes tedious; it is also laborious to make changes because each echo statement has to be formatted individually.

The original version of the gold Linux build script in Chapter 38 was written in that way. It created a temporary file used to partition a hard disk by outputting each partition table ...

Get Expert Shell Scripting 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.