Skip to content

Instantly share code, notes, and snippets.

@vcarel
Created November 24, 2014 14:30
Show Gist options
  • Save vcarel/abc6bfd38578884c0622 to your computer and use it in GitHub Desktop.
Save vcarel/abc6bfd38578884c0622 to your computer and use it in GitHub Desktop.
bash colored output
#!/bin/bash
DEFAULT="\e[39m"
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
BLUE="\e[34m"
MAGENTA="\e[35m"
CYAN="\e[36m"
GRAY="\e[37m"
DARK_GRAY="\e[90m"
LIGHT_RED="\e[91m"
LIGHT_GREEN="\e[92m"
LIGHT_YELLOW="\e[93m"
LIGHT_BLUE="\e[94m"
LIGHT_MAGENTA="\e[95m"
LIGHT_CYAN="\e[96m"
LIGHT_GRAY="\e[97m"
echo -e "see that ${DEFAULT}gray${DEFAULT} color"
echo -e "see that ${RED}red${DEFAULT} color"
echo -e "see that ${GREEN}green${DEFAULT} color"
echo -e "see that ${YELLOW}yellow${DEFAULT} color"
echo -e "see that ${BLUE}blue${DEFAULT} color"
echo -e "see that ${MAGENTA}magenta${DEFAULT} color"
echo -e "see that ${CYAN}cyan${DEFAULT} color"
echo -e "see that ${GRAY}gray${DEFAULT} color"
echo -e "see that ${LIGHT_GRAY}light gray${DEFAULT} color"
echo -e "see that ${DARK_GRAY}dark gray${DEFAULT} color"
echo -e "see that ${LIGHT_RED}light red${DEFAULT} color"
echo -e "see that ${LIGHT_GREEN}light green${DEFAULT} color"
echo -e "see that ${LIGHT_YELLOW}light yellow${DEFAULT} color"
echo -e "see that ${LIGHT_BLUE}light blue${DEFAULT} color"
echo -e "see that ${LIGHT_MAGENTA}light magenta${DEFAULT} color"
echo -e "see that ${LIGHT_CYAN}light cyan${DEFAULT} color"
echo -e $RED"this is a red sentence"$DEFAULT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment