Chapter 12. Screenplay: The screen—funcs Library

One of the first scripts I wrote printed a data-entry form on a terminal screen. This meant positioning the cursor at 30 or more different places for each record, and displaying some pieces of information in bold or reverse text. The usual method of positioning the cursor and setting attributes such as bold and reverse involves tput, a Unix utility that outputs screen codes for the particular terminal or terminal emulation you are using. Even with processors running at multi-gigahertz speeds, calling an external command 30 times can produce a noticeable delay.

I took the easy way out and placed the cursor-positioning codes for our terminals in a printat function, and the printing attributes (bold, ...

Get Shell Scripting Recipes: A Problem-Solution Approach 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.