Created
August 21, 2013 13:04
-
-
Save apbarrero/6294195 to your computer and use it in GitHub Desktop.
Elegant shellscript coloured output (via http://www.fizerkhan.com/blog/posts/What-I-learned-from-other-s-shell-scripts.html#colors-your-echo)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NORMAL=$(tput sgr0) | |
GREEN=$(tput setaf 2; tput bold) | |
YELLOW=$(tput setaf 3) | |
RED=$(tput setaf 1) | |
function red() { | |
echo -e "$RED$*$NORMAL" | |
} | |
function green() { | |
echo -e "$GREEN$*$NORMAL" | |
} | |
function yellow() { | |
echo -e "$YELLOW$*$NORMAL" | |
} | |
# To print success | |
green "Task has been completed" | |
# To print error | |
red "The configuration file does not exist" | |
# To print warning | |
yellow "You have to use higher version." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment