colorpipe

master
Ismael Barros 2013-12-15 22:06:43 +01:00
parent 64d127e460
commit 2556522c22
1 changed files with 3 additions and 0 deletions

View File

@ -9,6 +9,9 @@ NORMAL=$'\e[0m'
HILITE=$'\e[36;01m'
BRACKET=$'\e[34;01m'
# http://stackoverflow.com/questions/6841143/how-to-set-font-color-for-stdout-and-stderr
color()(set -o pipefail;"$@" 2>&1>&3|sed $'s,.*,\e[31m&\e[m,'>&2)3>&1
die() { echo -e ${BAD}$@${NORMAL}; exit 1; }
trimp() { sed -e 's/^[ \t]*//g' -e 's/[ \t]*$//g'; }
trim() { echo $@ | trimp; }