My Shell and Bash Prompt Configuration

I use Bash every day in my work and at home on projects and I find the default setup of the system to be cumbersome. Call me a geezer, but I missed my dos-style information on the command line. I’ve replicated some of that in the following way:

This is in my ~/.profile file
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/|\1/'

This code provides a pwd in green and then a simple > character to indicate where your command line begins. This is easy enough to customize — replace the > with a $ if you like that, or change the color with something other than 0;32m.
Then, it creates a pipe and the current git branch (if available)


Leave a Reply

Your email address will not be published. Required fields are marked *