Shell: Rewrite function

This commit is contained in:
Dylan Araps 2016-12-15 21:19:29 +11:00
parent f64ecff479
commit c6c4a47cf5
1 changed files with 10 additions and 20 deletions

View File

@ -494,38 +494,28 @@ get_packages() {
get_shell() { get_shell() {
case "$shell_path" in case "$shell_path" in
"on") shell="$SHELL" ;; "on") shell="$SHELL " ;;
"off") shell="${SHELL##*/}" ;; "off") shell="${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
} }