which/which2.sh

12 lines
412 B
Bash

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