Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. # /etc/bash/bashrc
  2. #
  3. # This file is sourced by all *interactive* bash shells on startup,
  4. # including some apparently interactive shells such as scp and rcp
  5. # that can't tolerate any output. So make sure this doesn't display
  6. # anything or bad things will happen !
  7.  
  8.  
  9. # Test for an interactive shell. There is no need to set anything
  10. # past this point for scp and rcp, and it's important to refrain from
  11. # outputting anything in those cases.
  12. if [[ $- != *i* ]] ; then
  13. # Shell is non-interactive. Be done now!
  14. return
  15. fi
  16.  
  17. # Bash won't get SIGWINCH if another process is in the foreground.
  18. # Enable checkwinsize so that bash will check the terminal size when
  19. # it regains control. #65623
  20. # http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
  21. shopt -s checkwinsize
  22.  
  23. # Disable completion when the input buffer is empty. i.e. Hitting tab
  24. # and waiting a long time for bash to expand all of $PATH.
  25. shopt -s no_empty_cmd_completion
  26.  
  27. # Enable history appending instead of overwriting when exiting. #139609
  28. shopt -s histappend
  29.  
  30. # Save each command to the history file as it's executed. #517342
  31. # This does mean sessions get interleaved when reading later on, but this
  32. # way the history is always up to date. History is not synced across live
  33. # sessions though; that is what `history -n` does.
  34. # Disabled by default due to concerns related to system recovery when $HOME
  35. # is under duress, or lives somewhere flaky (like NFS). Constantly syncing
  36. # the history will halt the shell prompt until it's finished.
  37. #PROMPT_COMMAND='history -a'
  38.  
  39. # Change the window title of X terminals
  40. case ${TERM} in
  41. [aEkx]term*|rxvt*|gnome*|konsole*|interix)
  42. PS1='\[\033]0;\u@\h:\w\007\]'
  43. ;;
  44. screen*)
  45. PS1='\[\033k\u@\h:\w\033\\\]'
  46. ;;
  47. *)
  48. unset PS1
  49. ;;
  50. esac
  51.  
  52. # Set colorful PS1 only on colorful terminals.
  53. # dircolors --print-database uses its own built-in database
  54. # instead of using /etc/DIR_COLORS. Try to use the external file
  55. # first to take advantage of user additions.
  56. # We run dircolors directly due to its changes in file syntax and
  57. # terminal name patching.
  58. use_color=false
  59. if type -P dircolors >/dev/null ; then
  60. # Enable colors for ls, etc. Prefer ~/.dir_colors #64489
  61. LS_COLORS=
  62. if [[ -f ~/.dir_colors ]] ; then
  63. eval "$(dircolors -b ~/.dir_colors)"
  64. elif [[ -f /etc/DIR_COLORS ]] ; then
  65. eval "$(dircolors -b /etc/DIR_COLORS)"
  66. else
  67. eval "$(dircolors -b)"
  68. fi
  69. # Note: We always evaluate the LS_COLORS setting even when it's the
  70. # default. If it isn't set, then `ls` will only colorize by default
  71. # based on file attributes and ignore extensions (even the compiled
  72. # in defaults of dircolors). #583814
  73. if [[ -n ${LS_COLORS:+set} ]] ; then
  74. use_color=true
  75. else
  76. # Delete it if it's empty as it's useless in that case.
  77. unset LS_COLORS
  78. fi
  79. else
  80. # Some systems (e.g. BSD & embedded) don't typically come with
  81. # dircolors so we need to hardcode some terminals in here.
  82. case ${TERM} in
  83. [aEkx]term*|rxvt*|gnome*|konsole*|screen|cons25|*color) use_color=true;;
  84. esac
  85. fi
  86.  
  87. if ${use_color} ; then
  88. if [[ ${EUID} == 0 ]] ; then
  89. PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
  90. else
  91. PS1+='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
  92. fi
  93.  
  94. alias ls='ls --color=auto'
  95. alias grep='grep --colour=auto'
  96. alias egrep='egrep --colour=auto'
  97. alias fgrep='fgrep --colour=auto'
  98. else
  99. if [[ ${EUID} == 0 ]] ; then
  100. # show root@ when we don't have colors
  101. PS1+='\u@\h \W \$ '
  102. else
  103. PS1+='\u@\h \w \$ '
  104. fi
  105. fi
  106.  
  107. for sh in /etc/bash/bashrc.d/* ; do
  108. [[ -r ${sh} ]] && source "${sh}"
  109. done
  110.  
  111. # Try to keep environment pollution down, EPA loves us.
  112. unset use_color sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement