color.sh 630 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # a board guy who loves colors.
  2. Reset='\e[0m'
  3. Red='\e[1;31m'
  4. Green='\e[1;32m'
  5. Yellow='\e[1;33m'
  6. ERROR() {
  7. echo -e "[${Red}ERROR${Reset}] ${Yellow}$1${Reset}"
  8. }
  9. WARNING() {
  10. echo -e "[${Yellow}WARNING${Reset}] ${Green}$1${Reset}"
  11. }
  12. QUESTION() {
  13. echo -e "${Yellow}**${Reset} ${Green}$1${Reset} ${Yellow}**${Reset}"
  14. }
  15. RED() {
  16. echo -e "${Red}$1${Reset}"
  17. }
  18. GREEN() {
  19. echo -e "${Green}$1${Reset}"
  20. }
  21. YELLOW() {
  22. echo -e "${Yellow}$1${Reset}"
  23. }
  24. case "$1" in
  25. "ERROR") ERROR "$2" ;;
  26. "WARNING") WARNING "$2" ;;
  27. "QUESTION") QUESTION "$2" ;;
  28. "RED") RED "$2" ;;
  29. "GREEN") GREEN "$2" ;;
  30. "YELLOW") YELLOW "$2" ;;
  31. esac