Blog/Colors in bash

From ~esantoro

These are a few lines of code to get some basic coloring when writing bash scripts.

I'm publishing them here because sometimes i have to use work other people's computers and it comes handy to be able to copy-and-paste them where needed.

function yellow {
    tput setaf 3 ; echo $1 ; tput sgr0
}

function red {
    tput setaf 1 ; echo $1 ; tput sgr0
}

function green {
    tput setaf 2 ; echo $1 ; tput sgr0
}

function cyan {
    tput setaf 6 ; echo $1 ; tput sgr0
}