Replace which with command -v.

http://stackoverflow.com/a/4785518/311196