Chapter 21. Creating screen output

Creating professional-looking screens for interactive use can be accomplished using shell scripts. All you need is a colour monitor and the tput command on your system.

In this chapter we will cover:

  • the tput command;

  • using escape sequences and generating control codes; and

  • using colour.

Whilst writing this book I came across three different variants of tput. By far the best was GNU tput. If you haven’t got this version, download it and install it on your system. Tput uses your /etc/terminfo or /etc/termcap file so you can use most commands that your terminal supports in your shell scripts.

Tput does not recognize colour settings, but we can take care of that using control characters.

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.