Useful Bash Scripts
Tuesday, April 7th, 2009
- Image via Wikipedia
Here’s a couple of bash scripts I’ve written recently that might be of use to someone.They work well under Ubuntu, and should work under any GNU/Linux or Unix system with the suitable software installed.
Improved “svn diff” command (ignores whitespace, colour highlights output, requires colordiff) – I put it in /usr/local/bin/svndiff:
#!/bin/bash
svn diff -x -w $@ | colordiff
Improved recursive grep command (greps recursively, ignores files in the .svn folders, ignores temporary files, highlights output in colour) – I put it in /usr/local/bin/grepr:
#!/bin/sh
SEARCHTERM=$1;
shift;
find . -type f -a -not -iname "*~" -a -not -iwholename "*/.svn/*" -exec grep -H --color=auto $@ "$SEARCHTERM" "{}" \;
You might also be interested in my previous “whoops I deleted files without telling svn” post here.

![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_c.png?x-id=2d71108e-406c-49e4-a42b-24959e42cab0)
![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_c.png?x-id=fb66b461-1ba1-4d58-a645-8eded5ab2ab4)