Linux from Scratch has a very tiny implementation suitable for all systems that have bash installed:
#!/bin/bash
type -pa "$@" | head -n 1 ; exit ${PIPESTATUS[0]}
Just save it as which, chmod +x and add to path.https://www.linuxfromscratch.org/blfs/view/svn/general/which...