A couple of useful functions for .bashrc :
#--------------------------------------------------------
* rlist()
#
* List/Kill RubyOnRails Processes
function rlist() {
# ps -aux | egrep -i "light|ruby" | grep -v grep
# if no args, list all
if [ $# == 0 ]
then
ps -aux | egrep -i "light|ruby" | grep -v grep
fi
# if 1 arg, list lines containing that arg
if [ $# == 1 ]
then
ps -aux | egrep -i "light|ruby" | grep -v grep | grep $1
fi
if [ $# == 2 ]
then
if [ $1 == 'kill' ]
then
tokill=`ps -aux | egrep -i "light|ruby" | grep -v grep | grep $2 | cut -f6 -d' '`
kill -9 $tokill
fi
fi
}
#--------------------------------------------------------
* srch()
#
* Find a word in files under the current directory,
* ignoring .svn and log files
function srch() {
grep -R $1 * | grep -v "\.svn" | grep -v "\.log"
}
#--------------------------------------------------------
* svndiff()
#
* Improved svn diff command
function svndiff() {
svn diff --diff-cmd /usr/bin/diff -x "-bB" $1
}
#--------------------------------------------------------
* svnedit()
#
* Edit svn log entries (need to enable pre-revprop-change
* hook first)
function svnedit() {
svn propedit svn:log --revprop -r $1 svn://localhost/analytics_server --editor-cmd vi
}