Skip to content
Ghetolay edited this page Dec 22, 2017 · 6 revisions

A collection of usage tips.

Applying changes

After modifying the appropriate bash configuration file, you need to log out and back in again in order to see your changes applied.

NB: If you are editing .bash_profile you can use source ~/.bash_profile to see changes without having to log out. Alternatively you can use exec $SHELL -l to reload your shell (as a simple source ~/.bash_profile can have unintended consequences).

Ubuntu

In Ubuntu the .bashrc sets the prompt with the following piece:

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

If you want to make use of the color_prompt variable you need to source the git-aware-prompt here by changing above to somehting like:

# Git aware prompt
export GITAWAREPROMPT=~/.bash/git-aware-prompt
source "${GITAWAREPROMPT}/main.sh"

if [ "$color_prompt" = yes ]; then
    PS1="\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ \$git_branch\[$txtred\]\$git_dirty '
fi
unset color_prompt force_color_prompt

Notice the use of double quote " and not single quote ' anymore.

During testing you can just as with the .bash_profile source the .bashrc by writing source ~/.bashrc to apply the changes.

Clone this wiki locally