Thanks to this reply, I just learned that 'pkill' is a thing! I've generally relied on killall - though it's not available on some platforms AFAIK.
To echo the larger point, I've written a bunch of similar scripts in my lifetime.
For a long time OS X didn't have `pkill`. I think it's there now with 10.8, but was missing for too many years.
I remember the one weird thing was that `killall` used to behave weirdly on commercial Unix. It would ignore its arguments and simply attempt to kill all processes. It's been a long time since I've logged into such a system, but it was then that I got used to typing `pkill`.
I have some very silly scripts hanging around. "killname.sh" dates from before I knew 'pkill' was a thing :)