Skip to content

Instantly share code, notes, and snippets.

@shellscriptx
Last active March 8, 2018 14:49
Show Gist options
  • Save shellscriptx/9265f03f9df04303997cfa505e0932b5 to your computer and use it in GitHub Desktop.
Save shellscriptx/9265f03f9df04303997cfa505e0932b5 to your computer and use it in GitHub Desktop.
# Cores
readonly VERMELHO='\e[31m'
readonly VERDE='\e[32m'
readonly AMARELO='\e[33m'
readonly AZUL='\e[34m'
readonly MAGENTA='\e[35m'
readonly NEGRITO='\e[1m'
readonly SEMCOR='\e[0m'

# Mensagem
function message(){
    case $1 in
      info)   cor="${VERDE}${NEGRITO}[INFO]";;
      erro)   cor="${VERMELHO}${NEGRITO}[ERRO]";;
      quest)  cor="${AZUL}${NEGRITO}[QUEST]";;
    esac
    
    echo -e "${cor} ${2}${SEMCOR}"
}

# Exibindo a mensagem correspondende com a paleta de cores.
message info "mensagem_aqui"
message erro "mensagem_aqui"
message quest "mensagem_aqui"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment