2 # /etc/bash.bashrc: System-wide rc file for interactive bash(1) shells.
3 # Written 2003-2013 by Alexander Barton (alex@barton.de)
6 [ -e ~/.ConfigScripts.debug ] && echo " >> /etc/bash.bashrc ..."
10 [ -z "$PROFILEREAD" -a -r /etc/profile ] && source /etc/profile
15 # Common command aliases (1/2)
16 alias ","="clear && logout"
23 set mark-directories on
24 set mark-symlinked-directories on
25 HISTCONTROL=ignoredups
32 # Make sure that the following commands are only run with bash >= 2.x
33 case "$BASH_VERSION" in
34 "0."*|"1."*) return; ;;
47 ssh -o "StrictHostKeyChecking no" "$@"
50 ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" "$@"
55 ansi|cons25|cygwin|dtterm|linux|rxvt|screen*|vt100|vt200|vt220|vt320| \
56 xterm|xterm-color|xterm-256color)
60 # 0: reset / 1: bright / 2: dim / 4: underline / 5: blink /
61 # 7: reverse / 8: hidden.
63 # 30: black / 31: red / 32: green / 33: yellow / 34: blue /
64 # 35: magenta / 36: cyan / 37: white
66 # 40: black / 41: red / 42: green / 43: yellow / 44: blue /
67 # 45: magenta / 46: cyan / 47: white
69 # colors for shell prompt etc.
70 COLOR_RESET="\[\e[0m\]"
71 COLOR_PREPOSTTXT="\[\e[1;37m\]"
72 COLOR_USER="\[\e[0;4m\]"
73 COLOR_AT="\[\e[0;37m\]"
74 COLOR_HOST="\[\e[0;4m\]"
75 COLOR_COLON="\[\e[0;37m\]"
77 COLOR_PROMPT_USER="\[\e[1;32m\]"
78 COLOR_PROMPT_ROOT="\[\e[1;31m\]"
79 COLOR_VCS="\[\e[1;33m\]"
81 # colors for less(1) pager
82 export LESS_TERMCAP_mb=$'\E[1;33m'
83 export LESS_TERMCAP_md=$'\E[1;31m'
84 export LESS_TERMCAP_me=$'\E[0m'
85 export LESS_TERMCAP_se=$'\E[0m'
86 export LESS_TERMCAP_so=$'\E[1;33;44m'
87 export LESS_TERMCAP_ue=$'\E[0m'
88 export LESS_TERMCAP_us=$'\E[1;32m'
91 # Enable bash completion, if available
92 if ! shopt -oq posix; then
93 [ -z "$BASH_COMPLETION" -a -r /etc/bash_completion ] \
94 && source /etc/bash_completion
95 [ -z "$BASH_COMPLETION" -a -r /usr/local/etc/bash_completion ] \
96 && source /usr/local/etc/bash_completion
97 [ -z "$BASH_COMPLETION" -a -r /opt/homebrew/etc/bash_completion ] \
98 && source /opt/homebrew/etc/bash_completion
99 [ -z "$BASH_COMPLETION" -a -r /opt/local/etc/bash_completion ] \
100 && source /opt/local/etc/bash_completion
106 echo "${P/???????????????????????????????*/${P:0:8}...${P: -20}}"
109 PS1="${COLOR_PREPOSTTXT}${PS1_BEGIN:-<}"
111 || PS1="${PS1}${COLOR_USER}\u${COLOR_AT}@"
112 PS1="${PS1}${COLOR_HOST}\h"
113 PS1="${PS1}${COLOR_COLON}:"
114 PS1="${PS1}${COLOR_PATH}\$(PS1_Path)"
115 PS1="${PS1}${COLOR_PREPOSTTXT}${PS1_END:->}${COLOR_RESET} "
117 && PS1="${PS1}${COLOR_PROMPT_ROOT}\\\$${COLOR_RESET} " \
118 || PS1="${PS1}${COLOR_PROMPT_USER}\\\$${COLOR_RESET} "
119 [ "$(type -t __git_ps1)" ] \
120 && PS1="\$(__git_ps1 '(${COLOR_VCS}%s${COLOR_RESET}) ')${PS1}"
121 PS1="${chroot_name:+[${COLOR_CHROOT}$chroot_name${COLOR_RESET}] }${PS1}"
122 PS1="${COLOR_RESET}${PS1}"
124 # If the command-not-found package is installed, use it
125 if [ -r /etc/bash_command_not_found ]; then
126 . /etc/bash_command_not_found
127 elif [ -x /usr/lib/command-not-found ]; then
128 function command_not_found_handle {
129 # Check because c-n-f could've been removed in the meantime
130 if [ -x /usr/lib/command-not-found ]; then
131 /usr/bin/python /usr/lib/command-not-found -- $1
139 # Common command aliases (2/2)
140 alias "lasth"="last | head -n \`expr \\\$LINES - 2\`"
142 # Aliases for screen(1), if installed
143 type -p screen >/dev/null 2>&1
144 if [ $? -eq 0 ]; then
146 alias "sr"="screen -dr"
147 alias "sx"="screen -x"
150 # less(1) filter, if available
151 type -p lesspipe >/dev/null 2>&1 && eval `lesspipe`
153 # Setup slrn(1) and cleanscore(1), if installed
154 type -p cleanscore >/dev/null 2>&1
155 [ $? -eq 0 ] && alias slrn="cleanscore -f ~/.slrnscore && slrn"
157 # Enable color support of ls(1) and also add handy aliases
158 if [ "$TERM" != "dumb" ]; then
159 type -p dircolors >/dev/null 2>&1 && eval `dircolors -b`
160 ls --color / >/dev/null 2>&1
161 if [ $? -eq 0 ]; then
163 alias ls="ls --color=auto -F"
165 ls -G / >/dev/null 2>&1
166 if [ $? -eq 0 ]; then
173 # If this is an xterm set the title to user@host:dir
176 PROMPT_COMMAND='printf "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
182 # Source local files, if readable
183 [ -r "/etc/bashrc.local" ] && source /etc/bashrc.local
184 [ -r "/etc/bash.bashrc.local" ] && source /etc/bash.bashrc.local
185 [ -r "/var/lib/$ME/bash.bashrc" ] && source /var/lib/$ME/bash.bashrc