Guest User

Untitled

a guest
Oct 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. # .bashrc
  2.  
  3. # User specific aliases and functions
  4.  
  5. alias rm='rm -i'
  6. alias cp='cp -i'
  7. alias mv='mv -i'
  8. alias ll='ls -al'
  9.  
  10. # Source global definitions
  11. if [ -f /etc/bashrc ]; then
  12. . /etc/bashrc
  13. fi
  14.  
  15.  
  16. # User specific aliases and functions
  17. find_git_branch () {
  18. local dir=. head
  19. until [ "$dir" -ef / ]; do
  20. if [ -f "$dir/.git/HEAD" ]; then
  21. head=$(< "$dir/.git/HEAD")
  22. if [[ $head = ref:\ refs/heads/* ]]; then
  23. git_branch=" → ${head#*/*/}"
  24. elif [[ $head != '' ]]; then
  25. git_branch=" → (detached)"
  26. else
  27. git_branch=" → (unknow)"
  28. fi
  29. return
  30. fi
  31. dir="../$dir"
  32. done
  33. git_branch=''
  34. }
  35.  
  36. PROMPT_COMMAND="find_git_branch; $PROMPT_COMMAND"
  37. # Here is bash color codes you can use
  38. black=$'\[\e[1;30m\]'
  39. red=$'\[\e[1;31m\]'
  40. green=$'\[\e[1;32m\]'
  41. yellow=$'\[\e[1;33m\]'
  42. blue=$'\[\e[1;34m\]'
  43. magenta=$'\[\e[1;35m\]'
  44. cyan=$'\[\e[1;36m\]'
  45. white=$'\[\e[1;37m\]'
  46. normal=$'\[\e[m\]'
  47.  
  48. ip=`/sbin/ifconfig br0 | awk -F '[ :]+' '/inet /{print $3}' | head -n1`
  49. PS1="$white[$green\u$white@$red$ip$white:$cyan\W$yellow\$git_branch$white]# $normal"
Add Comment
Please, Sign In to add comment