Skip to content

Instantly share code, notes, and snippets.

@RDCH106
Forked from iBet7o/description.md
Last active March 29, 2017 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RDCH106/9fdf84cd83fd1162f6558598590a70c7 to your computer and use it in GitHub Desktop.
Save RDCH106/9fdf84cd83fd1162f6558598590a70c7 to your computer and use it in GitHub Desktop.
Color del texto en scripts bash
#! /bin/bash
# Variables
# ------------------------------------------------------------------------------
txtSuccess='\033[1;32m'
txtError='\033[0;31m'
txtNoColor='\033[0m'
# Functions flash messages
# ------------------------------------------------------------------------------
function flashError {
echo -e "$txtError$1$txtNoColor"
}
function flashSuccess {
echo -e "$txtSuccess$1$txtNoColor"
}

Código de colores

Black        0;30     Dark Gray     1;30
Blue         0;34     Light Blue    1;34
Green        0;32     Light Green   1;32
Cyan         0;36     Light Cyan    1;36
Red          0;31     Light Red     1;31
Purple       0;35     Light Purple  1;35
Brown/Orange 0;33     Yellow        1;33
Light Gray   0;37     White         1;37
No color     0

Forma de uso:

echo -e "\033[0;31mThis is a message\033[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment