Skip to content

Instantly share code, notes, and snippets.

@davydany
Last active August 8, 2022 22:09
Show Gist options
  • Save davydany/43a1e4025e8013d61aea to your computer and use it in GitHub Desktop.
Save davydany/43a1e4025e8013d61aea to your computer and use it in GitHub Desktop.
log4bash :-D - Just putting colors for nice clean logs in bash
BLACK="\033[0;30m"
DARK_GRAY="\033[1;30m"
LIGHT_GRAY="\033[0;37m"
WHITE="\033[1;37m"
BLUE="\033[0;34m"
LIGHT_BLUE="\033[1;34m"
GREEN="\033[0;32m"
LIGHT_GREEN="\033[1;32m"
CYAN="\033[0;36m"
LIGHT_CYAN="\033[1;36m"
RED="\033[0;31m"
LIGHT_RED="\033[1;31m"
PURPLE="\033[0;35m"
LIGHT_PURPLE="\033[1;35m"
BROWN_ORANGE="\033[0;33m"
YELLOW="\033[1;33m"
NC="\033[0m" # No Color
echo -e "${RED}THIS ${GREEN}IS ${WHITE}AN ${BROWN_ORANGE}EXAMPLE ${NC}";
# Copy the following to setup 'exc' in your bash scripts
# exc - echo and execute
GREEN="\033[0;32m"
PURPLE="\033[0;35m"
NC="\033[0m" # No Color
exc() { echo -e "${GREEN}\$ $@ ${PURPLE}" ; "$@" ; echo -e "${NC}" ; }
# Usage:
# exc find / -name 'home' -type d
# Copy the following to setup 'log' in your bash scripts
# log - simply logs the string to console in 'BROWN_ORANGE'
BROWN_ORANGE="\033[0;33m"
NC="\033[0m" # No Color
log() { echo -e "${BROWN_ORANGE} $@ ${NC}"; }
# Usage:
# log "Hello World!"
BLACK="\033[0;30m"
DARK_GRAY="\033[1;30m"
LIGHT_GRAY="\033[0;37m"
WHITE="\033[1;37m"
BLUE="\033[0;34m"
LIGHT_BLUE="\033[1;34m"
GREEN="\033[0;32m"
LIGHT_GREEN="\033[1;32m"
CYAN="\033[0;36m"
LIGHT_CYAN="\033[1;36m"
RED="\033[0;31m"
LIGHT_RED="\033[1;31m"
PURPLE="\033[0;35m"
LIGHT_PURPLE="\033[1;35m"
BROWN_ORANGE="\033[0;33m"
YELLOW="\033[1;33m"
NC="\033[0m" # No Color
BROWN_ORANGE="\033[0;33m"
NC="\033[0m" # No Color
log() { echo -e "${BROWN_ORANGE} $@ ${NC}"; }
GREEN="\033[0;32m"
PURPLE="\033[0;35m"
NC="\033[0m" # No Color
exc() { echo -e "${GREEN}\$ $@ ${PURPLE}" ; "$@" ; echo -e "${NC}" ; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment