Right on the heels of the pidof script comes pkill. This command has started to show up in the latest versions of Linux and Solaris, so here's a script to get the same functionality under OS X:
#!/bin/sh
for X in `ps acx | grep -i $1 | awk {'print $1'}`; do
kill $X;
done
Put this script in /usr/bin/pkill, chmod it (chmod 755 /usr/bin/pkill), and use it like this:
Mac OS X Hints
http://hints.macworld.com/article.php?story=20030620102036392