88199b8014
- improved which2.sh
17 lines
363 B
Bash
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
|