samedi 28 février 2015

Why did a recent Ubuntu 14.04 update mess up my PS1 prompt?


I recently updated my Ubuntu 14.04 using the software update.


This caused some problems. Initially I couldn't open up a new terminal window due to unknown errors with my .bashrc I had to use another shell to remove my .bashrc file to fix it. While slowly adding back the .bashrc file I now have a problem with my PS1 prompt settings.


For a while I've used



git_branch () { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'; }
HOST='\033[02;36m\]\h'; HOST=' '$HOST
TIME='\033[01;31m\]\t \033[01;32m\]'
LOCATION=' \033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
BRANCH=' \033[00;33m\]$(git_branch)\[\033[00m\]\n\$ '
PS1=$TIME$USER$HOST$LOCATION$BRANCH
PS2='\[\033[01;36m\]>'


in my .bashrc to show time, user, host, pwd and git branch (in various colors) within my prompt.


After the upgrade I have a strange character at the start of each of those that didn't used to be there. Some sort of small outlined box with 4 tiny numbers in it !


enter image description here


What is causing this & how to fix it?



Aucun commentaire:

Enregistrer un commentaire