Simple image host.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. [ -z "$PS1" ] && return
  6. # don't put duplicate lines in the history. See bash(1) for more options
  7. # ... or force ignoredups and ignorespace
  8. HISTCONTROL=ignoredups:ignorespace
  9. # append to the history file, don't overwrite it
  10. shopt -s histappend
  11. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  12. HISTSIZE=1000
  13. HISTFILESIZE=2000
  14. # check the window size after each command and, if necessary,
  15. # update the values of LINES and COLUMNS.
  16. shopt -s checkwinsize
  17. # make less more friendly for non-text input files, see lesspipe(1)
  18. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  19. # set variable identifying the chroot you work in (used in the prompt below)
  20. if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
  21. debian_chroot=$(cat /etc/debian_chroot)
  22. fi
  23. export TERM='screen'
  24. # Alias definitions.
  25. # You may want to put all your additions into a separate file like
  26. # ~/.bash_aliases, instead of adding them here directly.
  27. # See /usr/share/doc/bash-doc/examples in the bash-doc package.
  28. if [ -f ~/.bash_aliases ]; then
  29. . ~/.bash_aliases
  30. fi
  31. # enable programmable completion features (you don't need to enable
  32. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  33. # sources /etc/bash.bashrc).
  34. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  35. . /etc/bash_completion
  36. fi
  37. # interface
  38. # ANSI CODES - SEPARATE MULTIPLE VALUES WITH ;
  39. #
  40. # 0 reset 4 underline
  41. # 1 bold 7 inverse
  42. #
  43. # FG BG COLOR FG BG COLOR
  44. # 30 40 black 34 44 blue
  45. # 31 41 red 35 45 magenta
  46. # 32 42 green 36 46 cyan
  47. # 33 43 yellow 37 47 white
  48. if [[ ! "${prompt_colors[@]}" ]]; then
  49. prompt_colors=(
  50. "0;37" # information color
  51. "1;30" # bracket color
  52. "0;31" # error color
  53. "1;31" # git color
  54. )
  55. if [[ "$SSH_TTY" ]]; then
  56. # connected via ssh
  57. prompt_colors[1]="1;32"
  58. elif [[ "$USER" == "root" ]]; then
  59. # logged in as root
  60. prompt_colors[1]="1;31"
  61. fi
  62. fi
  63. # Inside a prompt function, run this alias to setup local $c0-$c9 color vars.
  64. alias prompt_getcolors='prompt_colors[9]=; local i; for i in ${!prompt_colors[@]}; do local c$i="\[\e[0;${prompt_colors[$i]}m\]"; done'
  65. # Git status.
  66. function prompt_git() {
  67. prompt_getcolors
  68. local status output flags
  69. status="$(git status 2>/dev/null)"
  70. [[ $? != 0 ]] && return;
  71. output="$(echo "$status" | awk '/# Initial commit/ {print "(init)"}')"
  72. [[ "$output" ]] || output="$(echo "$status" | awk '/# On branch/ {print $4}')"
  73. [[ "$output" ]] || output="$(git branch | perl -ne '/^\* (.*)/ && print $1')"
  74. flags="$(
  75. echo "$status" | awk 'BEGIN {r=""} \
  76. /Changes to be committed:/ {r=r "+"}\
  77. /Changes not staged for commit:/ {r=r "!"}\
  78. /Untracked files:/ {r=r "?"}\
  79. END {print r}'
  80. )"
  81. if [[ "$flags" ]]; then
  82. output="$output$c1:$c3$flags"
  83. fi
  84. echo "$c1-$c3$output$c1$c9"
  85. }
  86. function prompt_command() {
  87. local exit_code=$?
  88. local pad=`printf "%03d" $exit_code`
  89. # If the first command in the stack is prompt_command, no command was run.
  90. # Set exit_code to 0 and reset the stack.
  91. [[ "${prompt_stack[0]}" == "prompt_command" ]] && exit_code=0
  92. prompt_stack=()
  93. # Manually load z here, after $? is checked, to keep $? from being clobbered.
  94. [[ "$(type -t _z)" ]] && _z --add "$(pwd -P 2>/dev/null)" 2>/dev/null
  95. # While the simple_prompt environment var is set, disable the awesome prompt.
  96. [[ "$simple_prompt" ]] && PS1='\n$ ' && return
  97. prompt_getcolors
  98. PS1="\n"
  99. # misc: [cmd#]
  100. #PS1="$PS1$c1[$c0#\#$c1]$c9"
  101. # name: user@host:path
  102. PS1="$PS1$c1[$c0$pad$c1|$c0\w$c1]$c9"
  103. # git: [branch:flags]
  104. PS1="$PS1$(prompt_git)"
  105. if [[ "$USER" == "root" ]]; then
  106. PS1="$PS1$c1 #\[\033[0;37m\] "
  107. else
  108. PS1="$PS1$c1 \$\[\033[0;37m\] "
  109. fi
  110. # Update the title with location
  111. echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"
  112. }
  113. PROMPT_COMMAND='prompt_command'