Created
June 3, 2011 19:59
-
-
Save wx13/1007056 to your computer and use it in GitHub Desktop.
bash script to colorize diff output, kind of like git does
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
#!/bin/bash | |
RED=`echo -e '\033[31m'` | |
GREEN=`echo -e '\033[32m'` | |
BLUE=`echo -e '\033[36m'` | |
YELLOW=`echo -e '\033[33m'` | |
NORMAL=`echo -e '\033[0m'` | |
diff -uN $@ \ | |
| sed "s/^@@.*@@/$BLUE&$NORMAL/g" \ | |
| sed "s/^\+[^+].*/$GREEN&$NORMAL/g" \ | |
| sed "s/^\-[^-].*/$RED&$NORMAL/g" \ | |
| sed "s/^\+\+\+/$GREEN&$NORMAL/g" \ | |
| sed "s/^\-\-\-/$RED&$NORMAL/g" \ | |
| less -R | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ok. very good