Skip to content

Instantly share code, notes, and snippets.

@sramam
Created May 7, 2014 15:18
Show Gist options
  • Save sramam/9c63c6f16a871e4d7127 to your computer and use it in GitHub Desktop.
Save sramam/9c63c6f16a871e4d7127 to your computer and use it in GitHub Desktop.
capture output of a command/script and colorize it on error
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