19 lines
471 B
Bash
19 lines
471 B
Bash
# shellcheck shell=sh
|
|
# Initialization script for bash, sh, mksh and ksh
|
|
|
|
which_shell="$(cat /proc/$$/comm)"
|
|
|
|
if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then
|
|
alias which_declare="typeset -fS"
|
|
which_opt=""
|
|
else
|
|
which_opt="-f"
|
|
alias which_declare="declare -f"
|
|
fi
|
|
|
|
which () {
|
|
(alias; which_declare) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
|
|
}
|
|
|
|
export ${which_opt} which
|