Merge pull request #27 from LudovicRousseau/master

Correctly handle login shell
This commit is contained in:
nojhan 2012-08-13 12:34:51 -07:00
commit ac5e05266b

View File

@ -39,6 +39,11 @@
WORKING_SHELL=$(ps -p $$ | tail -n1 | awk '{print $NF}') WORKING_SHELL=$(ps -p $$ | tail -n1 | awk '{print $NF}')
# A login shell starts with a "-"
if [[ "$WORKING_SHELL" == "-bash" ]]; then
WORKING_SHELL="bash"
fi
if [[ "$WORKING_SHELL" == "bash" ]]; then if [[ "$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; [[ -z "$BASH_VERSION" || -z "$PS1" || -z "$TERM" ]] && return;
@ -884,6 +889,8 @@ prompt_on()
LP_OLD_PROMPT_COMMAND="$PROMPT_COMMAND" LP_OLD_PROMPT_COMMAND="$PROMPT_COMMAND"
elif [[ "$WORKING_SHELL" == "zsh" ]]; then elif [[ "$WORKING_SHELL" == "zsh" ]]; then
LP_OLD_PROMPT_COMMAND="$precmd" LP_OLD_PROMPT_COMMAND="$precmd"
else
echo "${RED}Shell $WORKING_SHELL not supported $NO_COL"
fi fi
fi fi
if [[ "$WORKING_SHELL" == "bash" ]]; then if [[ "$WORKING_SHELL" == "bash" ]]; then