/bash.bashrc
http://github.com/brinkman83/bashrc · BASH · 162 lines · 74 code · 43 blank · 45 comment · 12 complexity · 82df53f52fc703b1e44d1939bb6778d5 MD5 · raw file
- # System-wide .bashrc file for interactive bash(1) shells.
- # If not running interactively, don't do anything
- [ -z "$PS1" ] && return
- ############################################
- echo -e "\n\n...loading /etc/bash.bashrc: \c"
- ############################################
- [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
- # Behavior intended for use by debuggers is enabled.
- # 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.
- # 2. If the command run by the DEBUG trap returns a non-zero value, the next command is skipped and not executed.
- # 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
- # executed by the . or source builtins), a call to return is simulated.
- # 4. BASH_ARGC and BASH_ARGV are updated as described in their descriptions above.
- # 5. Function tracing is enabled: command substitution, shell functions, and subshells invoked with ( command ) inherit the DEBUG and RETURN traps.
- # 6. Error tracing is enabled: command substitution, shell functions, and subshells invoked with ( command ) inherit the ERROR shopt -s extdebug
- shopt -s extdebug
- # check the window size after each command and, if necessary, update the values of LINES and COLUMNS.
- shopt -s checkwinsize
- # A command name that is the name of a directory is executed as if it were the argument to the cd command.
- shopt -s autocd
- # 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.
- shopt -s cdable_vars
- # Minor errors in the spelling of a directory component in a cd command will be corrected.
- shopt -s cdspell
- # bash checks cmds found in hash table exist before trying to exec. If cmd no longer exists, a normal path search is performed.
- shopt -s checkhash
- # bash lists the status of any stopped and running jobs before exiting an interactive shell.
- # Causes the exit to be deferred until a second exit is attempted without an intervening command.
- shopt -s checkjobs
- # bash attempts to save all lines of a multiple-line command in the same history entry.
- shopt -s cmdhist
- # bash attempts spelling correction on directory names during word completion if the directory name initially supplied does not exist.
- shopt -s dirspell
- # bash includes filenames beginning with a `.' in the results of pathname expansion.
- shopt -s dotglob
- # Extended pattern matching features described above under Pathname Expansion are enabled.
- shopt -s extglob
- # Patterns which fail to match filenames during pathname expansion result in an expansion error.
- ###shopt -s failglob
- # Shell error messages are written in the standard GNU error message format.
- shopt -s gnu_errfmt
- # 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.
- shopt -s histappend
- # User is given the opportunity to re-edit a failed history substitution.
- shopt -s histreedit
- # History substitution is not immediately passed to parser, the resulting line is loaded into the readline buffer, allowing further modification.
- shopt -s histverify
- # bash will send SIGHUP to all jobs when an interactive login shell exits.
- shopt -s huponexit
- # Multi-line commands are saved to the history with embedded newlines rather than using semi-colon separators where possible.
- shopt -s lithist
- # If a file bash is checking for mail is accessed since last checked, the message `The mail in mailfile has been read' is displayed.
- shopt -s mailwarn
- # bash will not attempt to search the PATH for possible completions when completion is attempted on an empty line.
- shopt -s no_empty_cmd_completion
- # bash matches filenames in a case-insensitive fashion when performing pathname expansion.
- shopt -s nocaseglob
- # The echo builtin expands backslash-escape sequences by default.
- shopt -s xpg_echo
- # Report the status of terminated background jobs immediately, rather than before the next primary prompt.
- set notify On
- # bash will not overwrite an existing file with the >, >&, and <> redirection operators.
- # This may be overridden when creating output files by using the redirection operator >| instead of >.
- set noclobber On
- set bell-style visible
- set completion-ignore-case On
- set enable-keypad On
- set mark-modified-lines On
- set visible-stats On
- set xtrace On
- # set variable identifying the chroot you work in (used in the prompt below)
- if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
- debian_chroot=$(cat /etc/debian_chroot)
- fi
- # set a fancy prompt (non-color, overwrite the one in /etc/profile)
- PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
- # Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
- # If this is an xterm set the title to user@host:dir
- case "$TERM" in
- xterm*|rxvt*)
- PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
- ;;
- *)
- ;;
- esac
- # enable bash completion in interactive shells
- if [ -f /etc/bash_completion ]; then
- . /etc/bash_completion
- fi
- # sudo hint
- if [ ! -e $HOME/.sudo_as_admin_successful ]; then
- case " $(groups) " in *\ admin\ *)
- if [ -x /usr/bin/sudo ]; then
- cat <<-EOF
- To run a command as administrator (user "root"), use "sudo <command>".
- See "man sudo_root" for details.
-
- EOF
- fi
- esac
- fi
- # if the command-not-found package is installed, use it
- if [ -x /usr/lib/command-not-found ]; then
- function command_not_found_handle {
- /usr/bin/python /usr/lib/command-not-found -- $1
- return $?
- }
- fi
- if [ -f /etc/bash.aliases ]; then
- echo -e "source /etc/bash.aliases: \c"
- source /etc/bash.aliases
- fi
- if [ -f /etc/bash.exports ]; then
- echo -e "...loading /etc/bash.bashrc: source /etc/bash.exports: \c"
- source /etc/bash.exports
- fi
- if [ -f /etc/bash.functions ]; then
- echo -e "...loading /etc/bash.bashrc: source /etc/bash.functions: \c"
- source /etc/bash.functions
- fi