which/which2.sh
Than Ngo 88199b8014 - fixed coverity issues
- improved which2.sh
2021-03-21 14:30:10 +01:00

17 lines
363 B
Bash

# Initialization script for bash, sh, mksh and ksh
_declare="declare -f"
_opt="-f"
if [ "$0" = "ksh" ] || [ "$0" = "-ksh" ] || [ "$0" = "mksh" ] || [ "$0" = "-mksh" ] ; then
_declare="typeset -f"
_opt=""
fi
which ()
{
(alias; eval ${_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@"
}
export ${_opt} which