diff --git a/bashrc b/bashrc
index 50204fd8d43f286ffd13691dfd120fa92eb4c146..e9664c6fb05bcc399a5916c6883b98e20245dd0f 100644
--- a/bashrc
+++ b/bashrc
@@ -51,10 +51,16 @@ fi
 
 if [ "$color_prompt" = yes ] && [ "`id -u`" -eq 0 ]; then
     # Red prompt for root
-    PS1='${debian_chroot:+($debian_chroot)}\h:\[\033[31m\][\w]\[\033[00m\] \$ '
+#    PS1='${debian_chroot:+($debian_chroot)}\h:\[\033[31m\][\w]\[\033[00m\] \$ '
+    PS1_PRE='${debian_chroot:+($debian_chroot)}\h:\[\033[31m\][\w]\[\033[00m\]'
+    PS1_POST=' \$ '
+    PS1="$PS1_PRE$PS1_POST"
 else
     # Default prompt for everyone else
-    PS1='${debian_chroot:+($debian_chroot)}\h:\[\033[38;5;25m\][\w]\[\033[00m\] \$ '
+#    PS1='${debian_chroot:+($debian_chroot)}\h:\[\033[38;5;25m\][\w]\[\033[00m\] \$ '
+    PS1_PRE='${debian_chroot:+($debian_chroot)}\h:\[\033[38;5;25m\][\w]\[\033[00m\]'
+    PS1_POST=' \$ '
+    PS1="$PS1_PRE$PS1_POST"
 fi
 unset color_prompt force_color_prompt
 
diff --git a/bashrc.local.example b/bashrc.local.example
index 125d26e11823f631e278a02ed89f84a0c941896f..25367120a1e6aa96e7f5cb5a2c97b1a5606d1c52 100644
--- a/bashrc.local.example
+++ b/bashrc.local.example
@@ -12,7 +12,12 @@ if [ -f ~/.git-prompt.sh ]; then
     source ~/.git-prompt.sh
 fi
 
-PROMPT_COMMAND='__git_ps1 "${debian_chroot:+($debian_chroot)}\h:\[\033[38;5;25m\][\w]\[\033[00m\]" " \$ " " {%s}"'
+if [ -z ${PS1_PRE+x} ] && [ -z ${PS1_POST+x} ]; then
+    PS1_PRE='${debian_chroot:+($debian_chroot)}\h:\[\033[38;5;25m\][\w]\[\033[00m\]'
+    PS1_POST=' \$ '
+fi
+
+PROMPT_COMMAND='__git_ps1 "$PS1_PRE" "$PS1_POST" " {%s}"'
 
 if [ -d $HOME/.virtualenvs ] && [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
     # If virtualenv was installed with python3, then we can assume that
@@ -52,5 +57,5 @@ if [ -d $HOME/.virtualenvs ] && [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
             fi
         fi
     }
-    PROMPT_COMMAND='__git_ps1 "${debian_chroot:+($debian_chroot)}$(add_venv_info)\h:\[\033[38;5;25m\][\w]\[\033[00m\]" " \$ " " {%s}"'
+    PROMPT_COMMAND='__git_ps1 "$PS1_PRE $(add_venv_info)" "$PS1_POST" " {%s}"'
 fi