From 1f0108193d8395424c83a1a80b770356399ad00a Mon Sep 17 00:00:00 2001 From: Ivan Font Date: Tue, 17 Jan 2017 00:01:49 -0800 Subject: [PATCH] Fix for issue #883 --- themes/base.theme.bash | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 42aaac58..753d075d 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -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 }