Shell: Rewrite function

This commit is contained in:
Dylan Araps 2016-12-15 21:19:29 +11:00
parent f64ecff479
commit c6c4a47cf5

View file

@ -499,33 +499,23 @@ get_shell() {
esac esac
if [[ "$shell_version" == "on" ]]; then if [[ "$shell_version" == "on" ]]; then
shell+=" "
case "${SHELL##*/}" in case "${SHELL##*/}" in
"bash") "bash") shell+="${BASH_VERSION/-*}" ;;
shell+=" ${BASH_VERSION/-*}"
;;
"zsh") "fish" | "zsh" | "tcsh" | "csh")
shell+="$(zsh --version)" shell+="$("$SHELL" --version)"
shell="${shell/ zsh}" shell="${shell/${SHELL##*/}}"
;; ;;
"mksh" | "ksh") "mksh" | "ksh")
shell+="$("$SHELL" -c 'printf "%s" "$KSH_VERSION"')" shell+="$("$SHELL" -c 'printf "%s" "$KSH_VERSION"')"
shell="${shell/ * KSH}" shell="${shell/ * KSH}"
;; ;;
"tcsh" | "csh")
shell+="$("$SHELL" --version)"
shell="${shell/tcsh}"
shell="${shell/\(*}"
;;
"fish")
shell+="$(fish --version)"
shell="${shell/fish, version}"
;;
esac esac
# Remove unwanted info
shell="${shell/, version}"
shell="${shell/options*}"
shell="${shell/\(*\)}" shell="${shell/\(*\)}"
fi fi
} }