Red hat linux Shell scripting

Color text output on bash scripts

Users who have been using Linux for awhile often learn that creating a basic script is a good way to run multiple, often-repeated commands. Adding a little color to scripts can additionally provide nice feedback. This can be done in a fairly straight-forward way by using the tput command.

A common way of doing this is to define the colors that tnput can produce by putting them at the beginning of the bash script:

Leave a Reply

Your email address will not be published. Required fields are marked *