I am trying to set my bash prompt to display the time and current directory in bold:
export PS1="\[\e[1m\][\A] \w \$ \[\e[0m\]"
This does apparently work, but when I use the command history (ctrl-r), after finding the command I was searching for and pressing enter, this line is not displayed correctly. Here is an example:
[21:58] ~/Wyona/svn-repos/zwischengas $
(reverse-i-search)`ta': tail -F logs/log4j-cnode1.log
becomes, after pressing enter:
[21:58] ~/Wyona/svn-repos/zwischengas $ -F logs/log4j-cnode1.log
Of course, this is not "really" a problem, since the command does work correctly, but it is still annoying. Does anybody know why this happens? And, more importantly, how to prevent/fix it?
\\[and\\]are supposed to take care of what you're describing and you have a very straightforward prompt. What version of Bash (echo $BASH_VERSION)? – Dennis Williamson May 23 '10 at 21:44GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)) – Doug Harris May 24 '10 at 14:58/bin/bashisGNU bash, version 3.2.48(1)-release– Stefan Lasiewski Dec 21 '11 at 20:48