Fix for issue #883

pull/888/head
Ivan Font 2017-01-17 00:01:49 -08:00
parent 3a9c65d541
commit 1f0108193d
1 changed files with 8 additions and 6 deletions

View File

@ -464,11 +464,13 @@ function aws_profile {
}
function safe_append_prompt_command {
if [[ -n $1 ]] ; then
case $PROMPT_COMMAND in
*$1*) ;;
"") PROMPT_COMMAND="$1";;
*) PROMPT_COMMAND="$1;$PROMPT_COMMAND";;
esac
local prompt_re="\<${1}\>" # exact match regex
if [[ ${PROMPT_COMMAND} =~ ${prompt_re} ]]; then
return
elif [[ -z ${PROMPT_COMMAND} ]]; then
PROMPT_COMMAND="${1}"
else
PROMPT_COMMAND="${1};${PROMPT_COMMAND}"
fi
}