#11 ANSI Color Sequences

Although you probably don't realize it, your standard terminal application supports different styles of presenting text. Quite a few variations are possible, whether you'd like to have certain words in your script displayed in bold, or even in red against a yellow background. However, working with ANSI (American National Standards Institute) sequences to represent these variations can be difficult because these sequences are quite user unfriendly. Therefore, this script fragment creates a set of variables, whose values represent the ANSI codes, that can turn on and off the various color and formatting display capabilities.

The Code

 #!/bin/sh # ANSI Color -- Use these variables to make output in different colors # and ...

Get Wicked Cool Shell Scripts 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.