Trying to use custom prompt with Git [1]

Trying to use custom prompt with Git

Monday, April 3, 2017 10:38 PM - Davis

Recently I've been trying to learn how to use Git.
I completed the related courses on FreeCodeCamp and started using Mintty terminal (from Git Bash install) as my terminal.
FreeCodeCamp also had some cool settings to add to the .bash_profile that customized the Terminal prompt:

# generated by Git for Windows
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc
# Enable tab completion
source ~/git-completion.bash

# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"

# Change command prompt
source ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '\$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory
export PS1="$purple\u$green\$(__git_ps1)$blue \W $ $reset"

This weekend I discovered Xshell....which seems like an even more useful Terminal Emulator. However, it doesn't seem to utilize the .bash_profile settings (which Mintty, CMDer did).
Can someone explain why, how, etc I would go about getting it to load similar?

Program Ver. : Xshell 5


Re: Trying to use custom prompt with Git

Friday, April 7, 2017 8:29 PM - Support

Your script seems to be working well.

Bash can use .bashrc as its startup file if the shell was called as a non login, such as an su command without the '-' parameter.

Please provide detailed instructions and screenshots to help us further investigate this issue.

Technical Support

Like us on Facebook
Follow us on Twitter
Visit our blog Blog


Previous views: 139