Created
June 1, 2015 07:33
-
-
Save kedder/1e2ef4f59b337f0887ce to your computer and use it in GitHub Desktop.
Colorize stream to one color (with bash)
This file contains hidden or 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
#!/bin/bash | |
declare -A colours | |
colours["black"]=$'\e[0;30m' | |
colours["red"]=$'\e[0;31m' | |
colours["green"]=$'\e[0;32m' | |
colours["yellow"]=$'\e[0;33m' | |
colours["blue"]=$'\e[0;34m' | |
colours["purple"]=$'\e[0;35m' | |
colours["cyan"]=$'\e[0;36m' | |
colours["white"]=$'\e[0;37m' | |
COLOROFF=$'\e[0m' | |
COLOR=${colours[$1]} | |
sed -e "s/^\(.*\)$/${COLOR}\1${COLOROFF}/g" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment