psre (Source)

#!/bin/bash
# BUUS: This script is part of Brian's Useful Utilities Set

if [ -z "$1" ]
then
    echo "usage: psre [-k|-HUP|-USR1|-USR2 ...] regexp" >&2
    exit 1
fi

if [ "$2" ]
then
    [ "$1" = '-k' ] && KILLSIG='-TERM' || KILLSIG=$1
    ps -ef | egrep "$2" | grep -v -e egrep -e psre | awk '{print $2}' | xargs kill $KILLSIG
else
    ps -ef | egrep "$1" | grep -v -e egrep -e psre
fi

# vim: tabstop=4