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

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