University of Oregon

Bash – Add drupal site name to PS1

I updated my bash prompt (PS1) the other day. Now it displays what site I’m in.
I recently posted my former change: An improved PS1 for Git in Bash.
Now I added an extra bit of code that inserts the current ‘site’.
It looks like this:

vid@server:( currentdir (origin [master])$ 


An improved PS1 for Git in Bash

Last year I updated my bash prompt (PS1) to include the active git branch name.
A few months ago I added to the the active repository name.
So here’s an example of my PS1 when I’m in a git tracked directory on the master branch:

vid@server mydirectory (origin [master])$ 

And here it is when I have other remote repositories for the same project (bronze and heuristics);

vid@server mydirectory (bronze | heuristics | origin [master])$ 

And now once more when I’m on a branch (devel) that doesn’t exist on the available remotes:

vid@server mydirectory (bronze | origin [devel])$ 

That’s achieved with these functions: parse_git_branch and show-git-current-remotes-short.