Color Output on Bash Scripts
Originally posted on Linuxtidbits:
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
A common way of doing this is to define the colors that
tput can produce by putting them at the beginning of the bash script:
=1 = =1 =4 =7 = =* =*=*=?
When writing new scripts using templates with these variables already defined can quicken the creation process and help keep scripts organized (my Bash Templates).
If just needing to use tput colors for specific instances this script can display the
tput definitions and their corresponding possibilities:
View original 93 more words