Merge pull request #35 from dolmen/fix/WORKING_SHELL
Fix shell detection
This commit is contained in:
commit
9f06ebe883
20
liquidprompt
20
liquidprompt
@ -37,17 +37,8 @@
|
|||||||
|
|
||||||
# See the README.md file for a summary of features.
|
# See the README.md file for a summary of features.
|
||||||
|
|
||||||
_LP_WORKING_SHELL=${SHELL##*/}
|
|
||||||
|
|
||||||
# A login shell starts with a "-"
|
|
||||||
if [[ "$_LP_WORKING_SHELL" == "-bash" ]]; then
|
|
||||||
_LP_WORKING_SHELL="bash"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$_LP_WORKING_SHELL" == "bash" ]]; then
|
|
||||||
# Check for recent enough version of bash.
|
# Check for recent enough version of bash.
|
||||||
[[ -z "$BASH_VERSION" || -z "$PS1" || -z "$TERM" ]] && return;
|
if test -n "$BASH_VERSION" -a -n "$PS1" -a -n "$TERM" ; then
|
||||||
|
|
||||||
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
|
bash=${BASH_VERSION%.*}; bmajor=${bash%.*}; bminor=${bash#*.}
|
||||||
if [[ $bmajor -lt 3 ]] || [[ $bmajor -eq 3 && $bminor -lt 2 ]]; then
|
if [[ $bmajor -lt 3 ]] || [[ $bmajor -eq 3 && $bminor -lt 2 ]]; then
|
||||||
unset bash bmajor bminor
|
unset bash bmajor bminor
|
||||||
@ -55,15 +46,20 @@ if [[ "$_LP_WORKING_SHELL" == "bash" ]]; then
|
|||||||
fi
|
fi
|
||||||
unset bash bmajor bminor
|
unset bash bmajor bminor
|
||||||
|
|
||||||
|
_LP_WORKING_SHELL=bash
|
||||||
_LP_OPEN_ESC="\["
|
_LP_OPEN_ESC="\["
|
||||||
_LP_CLOSE_ESC="\]"
|
_LP_CLOSE_ESC="\]"
|
||||||
_LP_USER_SYMBOL="\u"
|
_LP_USER_SYMBOL="\u"
|
||||||
_LP_HOST_SYMBOL="\h"
|
_LP_HOST_SYMBOL="\h"
|
||||||
elif [[ "$_LP_WORKING_SHELL" == "zsh" ]]; then
|
elif test -n "$ZSH_VERSION" ; then
|
||||||
|
_LP_WORKING_SHELL=zsh
|
||||||
_LP_OPEN_ESC="%{"
|
_LP_OPEN_ESC="%{"
|
||||||
_LP_CLOSE_ESC="%}"
|
_LP_CLOSE_ESC="%}"
|
||||||
_LP_USER_SYMBOL="%n"
|
_LP_USER_SYMBOL="%n"
|
||||||
_LP_HOST_SYMBOL="%m"
|
_LP_HOST_SYMBOL="%m"
|
||||||
|
else
|
||||||
|
echo "liquidprompt: shell not supported" >&2
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -963,8 +959,6 @@ prompt_on()
|
|||||||
LP_OLD_PROMPT_COMMAND="$PROMPT_COMMAND"
|
LP_OLD_PROMPT_COMMAND="$PROMPT_COMMAND"
|
||||||
elif [[ "$_LP_WORKING_SHELL" == "zsh" ]]; then
|
elif [[ "$_LP_WORKING_SHELL" == "zsh" ]]; then
|
||||||
LP_OLD_PROMPT_COMMAND="$precmd"
|
LP_OLD_PROMPT_COMMAND="$precmd"
|
||||||
else
|
|
||||||
echo "${RED}Shell $_LP_WORKING_SHELL not supported $NO_COL"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ "$_LP_WORKING_SHELL" == "bash" ]]; then
|
if [[ "$_LP_WORKING_SHELL" == "bash" ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user