PageRenderTime 36ms CodeModel.GetById 11ms app.highlight 21ms RepoModel.GetById 1ms app.codeStats 0ms

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