#!/usr/bin/env sh
which() {
local path
if [ $# -gt 0 ]; then
for path in $(IFS=: && echo ${PATH}); do
[ -x "${path}/${1}" ] && echo -n "${path}/${1}" && return 0
done
return 1
else
echo >&2 "Usage: which COMMAND"
echo >&2 "Writes the full path of COMMAND to standard output"
return 255
fi
}