Skip to content

Instantly share code, notes, and snippets.

@ptitfred
Created August 1, 2011 16:45
Show Gist options
  • Save ptitfred/1118495 to your computer and use it in GitHub Desktop.
Save ptitfred/1118495 to your computer and use it in GitHub Desktop.
Colorise stderr from a executable ; ERROR and WARNING rows are colorized in red and orange
#!/bin/bash
error="91"
warning="35"
( $1 3>&1 1>&2- 2>&3- ) | sed \
-e "s/^\(.* ERROR - \)\(.*\)$/\1\x1b[${error}m\2\x1b[0m/" \
-e "s/^\(.* WARNING - \)\(.*\)$/\1\x1b[${warning}m\2\x1b[0m/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment