function which-command() { local ANSWER=$(whence -w "${@}") || return $? ANSWER=${ANSWER##*: } [[ $ANSWER == "function" ]] && printf "function " && whence -f "${@}" && return [[ $ANSWER == "alias" ]] && { alias "${@}" } whence "${@}" }