Skip to content

Instantly share code, notes, and snippets.

@PaulChana
Last active August 29, 2015 14:23
Show Gist options
  • Save PaulChana/01a3497d127439070409 to your computer and use it in GitHub Desktop.
Save PaulChana/01a3497d127439070409 to your computer and use it in GitHub Desktop.
Colourize text in terminal
function printError
{
# Number after setaf is the colour...
# 0 - black
# 1 - red
# 2 - green
# 3 - yellow
# 4 - blue
# 5 - magenta
# 6 - cyan
# 7 - white
# This prints in red, to show an error
echo "$(tput setaf 1)$1$(tput sgr0)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment