2021-03-23 19:15:21 +00:00
|
|
|
# shellcheck shell=sh
|
2021-03-18 16:47:02 +00:00
|
|
|
# Initialization script for bash, sh, mksh and ksh
|
2021-03-21 13:30:10 +00:00
|
|
|
|
2021-04-26 12:02:33 +00:00
|
|
|
which_declare="declare -f"
|
|
|
|
which_opt="-f"
|
|
|
|
which_shell="$(cat /proc/$$/comm)"
|
2021-03-21 13:30:10 +00:00
|
|
|
|
2021-04-26 12:02:33 +00:00
|
|
|
if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then
|
|
|
|
which_declare="typeset -f"
|
|
|
|
which_opt=""
|
2021-03-21 13:30:10 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-18 16:47:02 +00:00
|
|
|
which ()
|
|
|
|
{
|
2021-04-26 12:02:33 +00:00
|
|
|
(alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@"
|
2021-03-18 16:47:02 +00:00
|
|
|
}
|
2021-03-21 13:30:10 +00:00
|
|
|
|
2021-04-26 12:02:33 +00:00
|
|
|
export ${which_opt} which
|