02.install_bash_git_prompt.sh 724 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. application=bash-git-prompt
  7. repository=https://github.com/magicmonty/bash-git-prompt.git
  8. mkdir -p ~/src
  9. cd ~/src || return
  10. if [ ! -d $application ]; then
  11. git clone $repository
  12. cd $application || return
  13. else
  14. cd $application || return
  15. git pull
  16. fi
  17. {
  18. echo ""
  19. echo "# bash git prompt"
  20. echo "if [ -f ~/src/bash-git-prompt/gitprompt.sh ]; then"
  21. echo " # To only show the git prompt in or under a repository directory"
  22. echo " GIT_PROMPT_ONLY_IN_REPO=1"
  23. echo " # To use upstream's default theme"
  24. echo " GIT_PROMPT_THEME=Default"
  25. echo " source ~/src/bash-git-prompt/gitprompt.sh"
  26. echo "fi"
  27. }>>~/.bashrc
  28. source ~/.bashrc