Skip to content

Instantly share code, notes, and snippets.

@mtrung
Created October 20, 2015 21:54
Show Gist options
  • Save mtrung/d5950a52249f423d4137 to your computer and use it in GitHub Desktop.
Save mtrung/d5950a52249f423d4137 to your computer and use it in GitHub Desktop.
echo text in color bash script
#!/bin/bash
start=\\033[
end=\\033[0m
Green=${start}32m
Yellow=${start}33m
Blue=${start}34m
Red=${start}31m
echo_d() {
echo -e "${Blue}${1}${end}"
}
echo_i() {
echo -e "${Green}${1}${end}"
}
echo_w() {
echo -e "${Yellow}${1}${end}"
}
echo_e() {
echo -e "${Red}${1}${end}"
}
echo_d Debug
echo_i Info
echo_w Warning
echo_e Error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment