Created
February 4, 2015 07:10
-
-
Save adionditsak/5627b6af4f719eb40137 to your computer and use it in GitHub Desktop.
cecho.sh - colorize shell output with pipe
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
cecho(){ | |
BLACK="\033[0;30m" | |
BLUE="\033[0;34m" | |
GREEN="\033[0;32m" | |
CYAN="\033[0;36m" | |
RED="\033[0;31m" | |
PURPLE="\033[0;35m" | |
ORANGE="\033[0;33m" | |
LGRAY="\033[0;37m" | |
DGRAY="\033[1;30m" | |
LBLUE="\033[1;34m" | |
LGREEN="\033[1;32m" | |
LCYAN="\033[1;36m" | |
LRED="\033[1;31m" | |
LPURPLE="\033[1;35m" | |
YELLOW="\033[1;33m" | |
WHITE="\033[1;37m" | |
NORMAL="\033[m" | |
color=\$${1:-NORMAL} | |
echo -ne "`eval echo ${color}`" | |
cat | |
echo -ne "${NORMAL}" | |
} |
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
source ./cecho.sh | |
echo "test" | cecho ORANGE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment