Last active
August 29, 2015 14:10
-
-
Save scriptum/4e76c6cca895cfcbc97f to your computer and use it in GitHub Desktop.
Function to colorize bash scripts
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
function color() { | |
case $1 in | |
red) tput setaf 1;; | |
green) tput setaf 2;; | |
yellow) tput setaf 3;; | |
blue) tput setaf 4;; | |
purple) tput setaf 5;; | |
cyan) tput setaf 6;; | |
white) tput setaf 7;; | |
#bold | |
bold) tput bold;; | |
bred) tput bold; tput setaf 1;; | |
bgreen) tput bold; tput setaf 2;; | |
byellow) tput bold; tput setaf 3;; | |
bblue) tput bold; tput setaf 4;; | |
bpurple) tput bold; tput setaf 5;; | |
bcyan) tput bold; tput setaf 6;; | |
bwhite) tput bold; tput setaf 7;; | |
reset) tput sgr0;; | |
*) echo "Usage: $0 [b]{red|green|yellow|blue|purple|cyan|white}|bold|reset";; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test: