You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bashrc 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # ~/.bashrc: executed by bash(1) for non-login shells.
  2. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
  3. # for examples
  4. # If not running interactively, don't do anything
  5. #if [ $(tty) = "/dev/tty1" ]
  6. #then
  7. # startx
  8. #fi
  9. case $- in
  10. *i*) ;;
  11. *) return;;
  12. esac
  13. source ~/.git-prompt.sh
  14. # don't put duplicate lines or lines starting with space in the history.
  15. # See bash(1) for more options
  16. HISTCONTROL=ignoreboth
  17. # append to the history file, don't overwrite it
  18. shopt -s histappend
  19. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  20. HISTSIZE=1000
  21. HISTFILESIZE=2000
  22. # check the window size after each command and, if necessary,
  23. # update the values of LINES and COLUMNS.
  24. shopt -s checkwinsize
  25. # If set, the pattern "**" used in a pathname expansion context will
  26. # match all files and zero or more directories and subdirectories.
  27. #shopt -s globstar
  28. # make less more friendly for non-text input files, see lesspipe(1)
  29. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  30. # set variable identifying the chroot you work in (used in the prompt below)
  31. if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
  32. debian_chroot=$(cat /etc/debian_chroot)
  33. fi
  34. # set a fancy prompt (non-color, unless we know we "want" color)
  35. case "$TERM" in
  36. xterm-color) color_prompt=yes;;
  37. esac
  38. # uncomment for a colored prompt, if the terminal has the capability; turned
  39. # off by default to not distract the user: the focus in a terminal window
  40. # should be on the output of commands, not on the prompt
  41. force_color_prompt=yes
  42. if [ -n "$force_color_prompt" ]; then
  43. if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
  44. # We have color support; assume it's compliant with Ecma-48
  45. # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
  46. # a case would tend to support setf rather than setaf.)
  47. color_prompt=yes
  48. else
  49. color_prompt=
  50. fi
  51. fi
  52. if [ "$color_prompt" = yes ]; then
  53. PS1='\[\e[01;31m\]$(_ps1_exit_status)\[\e[0m\]${debian_chroot:+($debian_chroot)}\u@\h:'"\[\e[01;34m\]\w\[\e[0m\]\[\e[01;32m\]"'$(__git_ps1 " [%s]")'"\[\e[0m\]\$ "
  54. else
  55. PS1='$?${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1)\$ '
  56. fi
  57. unset color_prompt force_color_prompt
  58. # If this is an xterm set the title to user@host:dir
  59. case "$TERM" in
  60. xterm*|rxvt*)
  61. PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
  62. ;;
  63. *)
  64. ;;
  65. esac
  66. # enable color support of ls and also add handy aliases
  67. if [ -x /usr/bin/dircolors ]; then
  68. test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  69. alias ls='ls --color=auto'
  70. #alias dir='dir --color=auto'
  71. #alias vdir='vdir --color=auto'
  72. alias grep='grep --color=auto'
  73. alias fgrep='fgrep --color=auto'
  74. alias egrep='egrep --color=auto'
  75. fi
  76. # some more ls aliases
  77. alias ll='ls -alF'
  78. alias la='ls -A'
  79. alias l='ls -CF'
  80. # Add an "alert" alias for long running commands. Use like so:
  81. # sleep 10; alert
  82. # Alias definitions.
  83. # You may want to put all your additions into a separate file like
  84. # ~/.bash_aliases, instead of adding them here directly.
  85. # See /usr/share/doc/bash-doc/examples in the bash-doc package.
  86. if [ -f ~/.bash_aliases ]; then
  87. . ~/.bash_aliases
  88. fi
  89. # enable programmable completion features (you don't need to enable
  90. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  91. # sources /etc/bash.bashrc).
  92. if ! shopt -oq posix; then
  93. if [ -f /usr/share/bash-completion/bash_completion ]; then
  94. . /usr/share/bash-completion/bash_completion
  95. elif [ -f /etc/bash_completion ]; then
  96. . /etc/bash_completion
  97. fi
  98. fi
  99. export PATH="$PATH:/sbin:/usr/sbin/:/usr/local/bin/android-studio/bin/:/home/robin/Android/Sdk/platform-tools/:/usr/local/bin/intellij/bin/;/home/robin/.composer/vendor/bin:/home/robin/tools/maven/bin"
  100. reg_ip='([0-9]{1,3}\.){3}[0-9]{1,3}'
  101. reg_mac='([0-9a-f]{2}:){5}[0-9a-f]{2}'
  102. _ps1_exit_status()
  103. {
  104. status=$?
  105. if [ ${status} -ne 0 ]
  106. then
  107. echo "${status} "
  108. fi
  109. }
  110. up()
  111. {
  112. if [ $# -eq 0 ]
  113. then
  114. cd ..
  115. else
  116. if echo "$1" | grep -E "[0-9]+" 1>/dev/null 2>/dev/null
  117. then
  118. i=$1
  119. while [ $i -gt 0 ]
  120. do
  121. cd ..
  122. i=$(($i - 1))
  123. done
  124. else
  125. echo "Usage: $0 count" >&2
  126. echo "count: number of directory to up" >&2
  127. fi
  128. fi
  129. }
  130. . ~/.bash_aliases
  131. . ~/.bash_preexec
  132. . ~/.bash_preexec_hooks