Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- COLOUR_RED="\[\033[0;31m\]"
- COLOUR_GREEN="\[\033[0;32m\]"
- COLOUR_BLUE="\[\033[0;34m\]"
- COLOUR_NONE="\[\e[0m\]"
- function git_prompt {
- local STATUS=`git status 2>&1`
- if [[ "$STATUS" == *'Not a git repository'* ]]; then
- echo "$"
- else
- if [[ "$STATUS" == *'working directory clean'* ]]; then
- echo "${COLOUR_GREEN}\[±\]${COLOUR_NONE}"
- else
- if [[ "$STATUS" == *"Changes not staged for commit:"* ]]; then
- echo "${COLOUR_RED}\[±\]${COLOUR_NONE}"
- elif [[ "$STATUS" == *"Untracked files:"* ]]; then
- echo "${COLOUR_RED}\[±\]${COLOUR_NONE}"
- else
- echo "${COLOUR_BLUE}\[±\]${COLOUR_NONE}"
- fi
- fi
- fi
- }
- export PS1='\w $(git_prompt) '
Add Comment
Please, Sign In to add comment