2021-10-06 13:11:35 +00:00
|
|
|
# shellcheck shell=sh
|
|
|
|
# Initialization script for bash, sh, mksh and ksh
|
2019-08-01 01:04:47 +00:00
|
|
|
|
2021-10-06 13:11:35 +00:00
|
|
|
which_declare="declare -f"
|
|
|
|
which_opt="-f"
|
|
|
|
which_shell="$(cat /proc/$$/comm)"
|
|
|
|
|
|
|
|
if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then
|
|
|
|
which_declare="typeset -f"
|
|
|
|
which_opt=""
|
2019-08-01 01:04:47 +00:00
|
|
|
fi
|
2021-10-06 13:11:35 +00:00
|
|
|
|
|
|
|
which ()
|
|
|
|
{
|
|
|
|
(alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
export which_declare
|
|
|
|
export ${which_opt} which
|