I am trying to add Git branch name to my Bash prompt by changing the
PS1 variable like this:
PS1=`echo "$PS1" | sed 's/\\\\\$ $/\$(__git_ps1)\\\\\$ /'`
And if I understand correctly, it is not recommended to update
~/.bashrc for personalizing purposes. All articles I found suggest updating either
.bash_profile for such purposes. So I am looking for a perfect place to put this line into.
These are the places I've tried so far:
.profile: not sourced by
.bash_profile: not sourced by
.bash_login: not sourced by
.bash_aliases: works, but I don't think
PS1has anything to do with aliases
I am using Ubuntu Desktop and I work in
byobu, so I have to find a file which is sourced when I start
bash in an X environment. Then I looked in
.bashrc for other files it sources after assigning a value to
PS1. There are
/usr/share/bash-completion/bash_completion which I don't think are proper for this purpose.
What are other choices? And what is the best practice of customizing Bash prompt?