From 6dea91ecf6b8825966d15bae2dc91314f5ca62a1 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sat, 4 Aug 2012 19:19:09 +0200 Subject: [PATCH] keep existing PROMPT_COMMAND if available --- liquidprompt.bash | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/liquidprompt.bash b/liquidprompt.bash index b2b0772..aaa2da1 100755 --- a/liquidprompt.bash +++ b/liquidprompt.bash @@ -755,15 +755,19 @@ __set_bash_prompt() # Activate the liquid prompt prompt_on() { - LP_OLD_PROMPT="$PS1" + LP_OLD_PS1="$PS1" LP_OLD_PROMPT_COMMAND="$PROMPT_COMMAND" - PROMPT_COMMAND="$PROMPT_COMMAND;__set_bash_prompt" + if [[ -z "$PROMPT_COMMAND" ]] ; then + PROMPT_COMMAND=__set_bash_prompt + else + PROMPT_COMMAND=$PROMPT_COMMAND;__set_bash_prompt + fi } # Come back to the old prompt prompt_off() { - PS1=$LP_OLD_PROMPT + PS1=$LP_OLD_PS1 PROMPT_COMMAND=$LP_OLD_PROMPT_COMMAND }