Skip to content

Instantly share code, notes, and snippets.

@bellcliff
Created September 3, 2014 03:22
Show Gist options
  • Select an option

  • Save bellcliff/47effba1b9c4ab8d1b79 to your computer and use it in GitHub Desktop.

Select an option

Save bellcliff/47effba1b9c4ab8d1b79 to your computer and use it in GitHub Desktop.
working on ios
sed need one more parameter
bash_profile will be loaded, not profile or bashrc
PS1 need export
function parse_git_branch() {
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
if [[ -z "$branch" ]]; then return; fi
if [[ -z "$(git status -s 2>/dev/null)" ]]; then
color=$'\e[1;32m'
else
color=$'\e[1;31m'
fi
echo "\[$color\] (${branch}) "
}
export PS1="\e[0;34m[\$(date +%k:%M:%S)]\e[0m \u@\h: \w $(parse_git_branch)\[\e[0m\]\n => "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment