/bash.bashrc

http://github.com/brinkman83/bashrc · BASH · 162 lines · 74 code · 43 blank · 45 comment · 12 complexity · 82df53f52fc703b1e44d1939bb6778d5 MD5 · raw file

  1. # System-wide .bashrc file for interactive bash(1) shells.
  2. # If not running interactively, don't do anything
  3. [ -z "$PS1" ] && return
  4. ############################################
  5. echo -e "\n\n...loading /etc/bash.bashrc: \c"
  6. ############################################
  7. [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
  8. # Behavior intended for use by debuggers is enabled.
  9. # 1. The -F option to the declare builtin displays the source file name and line number corresponding to each function name supplied as an argument.
  10. # 2. If the command run by the DEBUG trap returns a non-zero value, the next command is skipped and not executed.
  11. # 3. If the command run by the DEBUG trap returns a value of 2, and the shell is executing in a subroutine (a shell function or a shell script
  12. # executed by the . or source builtins), a call to return is simulated.
  13. # 4. BASH_ARGC and BASH_ARGV are updated as described in their descriptions above.
  14. # 5. Function tracing is enabled: command substitution, shell functions, and subshells invoked with ( command ) inherit the DEBUG and RETURN traps.
  15. # 6. Error tracing is enabled: command substitution, shell functions, and subshells invoked with ( command ) inherit the ERROR shopt -s extdebug
  16. shopt -s extdebug
  17. # check the window size after each command and, if necessary, update the values of LINES and COLUMNS.
  18. shopt -s checkwinsize
  19. # A command name that is the name of a directory is executed as if it were the argument to the cd command.
  20. shopt -s autocd
  21. # Arguments to builtin command 'cd' that is not a directory is assumed to be the name of a variable whose value is the directory to change to.
  22. shopt -s cdable_vars
  23. # Minor errors in the spelling of a directory component in a cd command will be corrected.
  24. shopt -s cdspell
  25. # bash checks cmds found in hash table exist before trying to exec. If cmd no longer exists, a normal path search is performed.
  26. shopt -s checkhash
  27. # bash lists the status of any stopped and running jobs before exiting an interactive shell.
  28. # Causes the exit to be deferred until a second exit is attempted without an intervening command.
  29. shopt -s checkjobs
  30. # bash attempts to save all lines of a multiple-line command in the same history entry.
  31. shopt -s cmdhist
  32. # bash attempts spelling correction on directory names during word completion if the directory name initially supplied does not exist.
  33. shopt -s dirspell
  34. # bash includes filenames beginning with a `.' in the results of pathname expansion.
  35. shopt -s dotglob
  36. # Extended pattern matching features described above under Pathname Expansion are enabled.
  37. shopt -s extglob
  38. # Patterns which fail to match filenames during pathname expansion result in an expansion error.
  39. ###shopt -s failglob
  40. # Shell error messages are written in the standard GNU error message format.
  41. shopt -s gnu_errfmt
  42. # History list is appended to the file named by the value of the HISTFILE variable when the shell exits, rather than over writing the file.
  43. shopt -s histappend
  44. # User is given the opportunity to re-edit a failed history substitution.
  45. shopt -s histreedit
  46. # History substitution is not immediately passed to parser, the resulting line is loaded into the readline buffer, allowing further modification.
  47. shopt -s histverify
  48. # bash will send SIGHUP to all jobs when an interactive login shell exits.
  49. shopt -s huponexit
  50. # Multi-line commands are saved to the history with embedded newlines rather than using semi-colon separators where possible.
  51. shopt -s lithist
  52. # If a file bash is checking for mail is accessed since last checked, the message `The mail in mailfile has been read' is displayed.
  53. shopt -s mailwarn
  54. # bash will not attempt to search the PATH for possible completions when completion is attempted on an empty line.
  55. shopt -s no_empty_cmd_completion
  56. # bash matches filenames in a case-insensitive fashion when performing pathname expansion.
  57. shopt -s nocaseglob
  58. # The echo builtin expands backslash-escape sequences by default.
  59. shopt -s xpg_echo
  60. # Report the status of terminated background jobs immediately, rather than before the next primary prompt.
  61. set notify On
  62. # bash will not overwrite an existing file with the >, >&, and <> redirection operators.
  63. # This may be overridden when creating output files by using the redirection operator >| instead of >.
  64. set noclobber On
  65. set bell-style visible
  66. set completion-ignore-case On
  67. set enable-keypad On
  68. set mark-modified-lines On
  69. set visible-stats On
  70. set xtrace On
  71. # set variable identifying the chroot you work in (used in the prompt below)
  72. if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
  73. debian_chroot=$(cat /etc/debian_chroot)
  74. fi
  75. # set a fancy prompt (non-color, overwrite the one in /etc/profile)
  76. PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  77. # Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
  78. # If this is an xterm set the title to user@host:dir
  79. case "$TERM" in
  80. xterm*|rxvt*)
  81. PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
  82. ;;
  83. *)
  84. ;;
  85. esac
  86. # enable bash completion in interactive shells
  87. if [ -f /etc/bash_completion ]; then
  88. . /etc/bash_completion
  89. fi
  90. # sudo hint
  91. if [ ! -e $HOME/.sudo_as_admin_successful ]; then
  92. case " $(groups) " in *\ admin\ *)
  93. if [ -x /usr/bin/sudo ]; then
  94. cat <<-EOF
  95. To run a command as administrator (user "root"), use "sudo <command>".
  96. See "man sudo_root" for details.
  97. EOF
  98. fi
  99. esac
  100. fi
  101. # if the command-not-found package is installed, use it
  102. if [ -x /usr/lib/command-not-found ]; then
  103. function command_not_found_handle {
  104. /usr/bin/python /usr/lib/command-not-found -- $1
  105. return $?
  106. }
  107. fi
  108. if [ -f /etc/bash.aliases ]; then
  109. echo -e "source /etc/bash.aliases: \c"
  110. source /etc/bash.aliases
  111. fi
  112. if [ -f /etc/bash.exports ]; then
  113. echo -e "...loading /etc/bash.bashrc: source /etc/bash.exports: \c"
  114. source /etc/bash.exports
  115. fi
  116. if [ -f /etc/bash.functions ]; then
  117. echo -e "...loading /etc/bash.bashrc: source /etc/bash.functions: \c"
  118. source /etc/bash.functions
  119. fi