I set up a PROMPT_COMMAND to display the current branch while I'm in a git repo.The relevant part of my .bashrc is:export PS1= \[\033[34m\]\$\[\033[0m\] export PROMPT_COMMAND=$HOME/bin/mypromptwhere ~/bin/myprompt is:#!/usr/bin/env rubygreen = \033[32mbold = \033[1munderline = \033[4mreset = \033[0mhome_regex = Regexp.new ^#{ENV[HOME]}Dir.chdir ENV[PWD]out =   underline + bold + green +  `pwd`.gsub(home_regex, ~).chomp +  resetif `git log 2>&1 | grep ^fatal`.chomp ==   out += #{underline}#{green} (#{`git branch | grep ^\* | sed s/^..//g`.chomp})#{reset}endprint outIt works fine for the most part, the only problem is that when I use the arrow keys to scroll through command history, sometimes the command gets written over my prompt. Suppose the following session:~ $ pwd/Users/Adrian~ $ cd sibilant~/sibilant (master) $ pwd/Users/Adrian/sibilant~/sibilant (master) $Then I press the up arrow to scroll through command history. each line shows the result of one press of the arrow:~/sibilant (master) $ pwd~/sibilant (master) $ cd sibilant~/spwdas you can see, the last time I pressed the arrow the command was written over my prompt.Has anyone experienced this and/or know how to fix it?
Bash $PROMPT_COMMAND messing up scroll history display
bash;prompt