#!/bin/bash PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}<\t> \[\033[01;32m\]\u\[\033[00m\]@\[\033[01;33m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]' set -o pipefail if branch=$(git branch 2>/dev/null | grep '\*' | cut -d' ' -f2) then if git status --porcelain | grep -q "^.\S" then PS1="$PS1 \[\033[01;31m\]" elif git status --porcelain | grep -q "^\S" then PS1="$PS1 \[\033[01;33m\]" else PS1="$PS1 \[\033[01;32m\]" fi PS1="$PS1$branch\[\033[00m\]\$ " else PS1="$PS1\$ " fi