My custom bash prompt

This is my custom bash prompt, as defined in my profile (~/.bash_profile). It includes a custom character for the prompt, the path, and the Git branch name (if any). The whole thing is colorful to make it a bit easier to identify the prompt in a sea of characters.

When I’m working on this WordPress theme for example, it looks sort of like this (RSS readers, you’ll miss the colors):

~/sites/commonplace-wp-theme (v0.1.5)

To generate something else, try messing around with the Bash $PS1 Generator.

If you want to try something like this, do not delete the rest of your profile. Just add this at the top.

# Get the Git branch
parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'

# Custom bash prompt
# Includes custom character for the prompt, the path, and Git branch name. With colors!
# Source:
export PS1="\n\[$(tput bold)\]\[$(tput setaf 5)\]➜ \[$(tput setaf 6)\]\w\[$(tput setaf 3)\]\$(parse_git_branch) \[$(tput sgr0)\]"

Note: I got this from someone else at some point… I’m trying to figure out who but haven’t gotten to the bottom of it.


Linter (scss-lint) not working in Atom

Linting package linter-scss-lint was not working properly for me, with no linting occurring and no errors thrown. On top of that, other linters were functioning properly (i.e. linter-jshint). Came across issue Linters not linting…, and one comment suggested opening Atom from the command line. Tried this, and linter-scss-lint began working properly. Upon further searching, found issue noting that $PATH only present when Atom is launched from the command line.

Look in to this with Sam, he’s not having the same problems even though our .bash_profile and .bashrc files are the same. Check versions of Atom, all packages, Ruby, etc.