by foresto 3 hours ago

For those who don't know how to properly get the active terminal's color escape codes...

green=$(tput setaf 2)

normal=$(tput sgr0)

echo ${green}Color${normal} text.

...or if you plan to run on non-POSIX systems that lack tput...

green=$(tput setaf 2 2>/dev/null || true)