Skip to content

Instantly share code, notes, and snippets.

@jnbdz
Last active March 24, 2019 20:45
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 jnbdz/9258b82ab31a320ddadc1db411d5fe4a to your computer and use it in GitHub Desktop.
Save jnbdz/9258b82ab31a320ddadc1db411d5fe4a to your computer and use it in GitHub Desktop.
Coloring diff msg types
#!/usr/bin/env bash
# Source: https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# $1 - Message
errorMsg() {
echo -e " > - ${RED}ERROR${NC} - "${1}
}
# $1 - Message
warningMsg() {
echo -e " > - ${YELLOW}WARNING${NC} - "${1}
}
# $1 - Message
successMsg() {
echo -e " > - ${GREEN}SUCCESS${NC} - "${1}
}
# $1 - Message
simpleMsg() {
echo -e " > "${1}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment