Created
May 7, 2014 15:18
-
-
Save sramam/9c63c6f16a871e4d7127 to your computer and use it in GitHub Desktop.
capture output of a command/script and colorize it on error
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
set -e | |
color()(set -o pipefail;"$@" 2>&1>&3|sed $'s,.*,\e[31m&\e[m,'>&2)3>&1 | |
color script_cmd_to_run $* | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment