2 # /etc/bash.bashrc: System-wide rc file for interactive bash(1) shells.
3 # Written 2003-2010 by Alexander Barton (alex@barton.de)
6 [ -e ~/.ConfigScripts.debug ] && echo " >> /etc/bash.bashrc ..."
10 [ -z "$PROFILEREAD" -a -r /etc/profile ] && source /etc/profile
19 set mark-directories on
20 set mark-symlinked-directories on
21 HISTCONTROL=ignoredups
25 ssh -o "StrictHostKeyChecking no" "$@"
28 ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" "$@"
33 ansi|cons25|cygwin|dtterm|linux|rxvt|screen*|vt100|vt200|vt220|vt320| \
38 # 0: reset / 1: bright / 2: dim / 4: underline / 5: blink /
39 # 7: reverse / 8: hidden.
41 # 30: black / 31: red / 32: green / 33: yellow / 34: blue /
42 # 35: magenta / 36: cyan / 37: white
44 # 40: black / 41: red / 42: green / 43: yellow / 44: blue /
45 # 45: magenta / 46: cyan / 47: white
47 # colors for shell prompt etc.
48 COLOR_RESET="\[\e[0m\]"
49 COLOR_PREPOSTTXT="\[\e[1;37m\]"
50 COLOR_USER="\[\e[0;4m\]"
51 COLOR_AT="\[\e[0;37m\]"
52 COLOR_HOST="\[\e[0;4m\]"
53 COLOR_COLON="\[\e[0;37m\]"
55 COLOR_PROMPT_USER="\[\e[1;32m\]"
56 COLOR_PROMPT_ROOT="\[\e[1;31m\]"
57 COLOR_VCS="\[\e[1;33m\]"
59 # colors for less(1) pager
60 export LESS_TERMCAP_mb=$'\E[1;33m'
61 export LESS_TERMCAP_md=$'\E[1;31m'
62 export LESS_TERMCAP_me=$'\E[0m'
63 export LESS_TERMCAP_se=$'\E[0m'
64 export LESS_TERMCAP_so=$'\E[1;33;44m'
65 export LESS_TERMCAP_ue=$'\E[0m'
66 export LESS_TERMCAP_us=$'\E[1;32m'
69 # Enable bash completion, if available
70 [ -z "$BASH_COMPLETION" -a -r /etc/bash_completion ] \
71 && source /etc/bash_completion
72 [ -z "$BASH_COMPLETION" -a -r /opt/homebrew/etc/bash_completion ] \
73 && source /opt/homebrew/etc/bash_completion
74 [ -z "$BASH_COMPLETION" -a -r /opt/local/etc/bash_completion ] \
75 && source /opt/local/etc/bash_completion
80 echo "${P/???????????????????????????????*/${P:0:8}...${P: -20}}"
83 PS1="${COLOR_PREPOSTTXT}${PS1_BEGIN:-<}"
85 || PS1="${PS1}${COLOR_USER}\u${COLOR_AT}@"
86 PS1="${PS1}${COLOR_HOST}\h"
87 PS1="${PS1}${COLOR_COLON}:"
88 PS1="${PS1}${COLOR_PATH}\$(PS1_Path)"
89 PS1="${PS1}${COLOR_PREPOSTTXT}${PS1_END:->}${COLOR_RESET} "
91 && PS1="${PS1}${COLOR_PROMPT_ROOT}\\\$${COLOR_RESET} " \
92 || PS1="${PS1}${COLOR_PROMPT_USER}\\\$${COLOR_RESET} "
93 [ "$(type -t __git_ps1)" ] \
94 && PS1="\$(__git_ps1 '(${COLOR_VCS}%s${COLOR_RESET}) ')${PS1}"
95 PS1="${chroot_name:+[${COLOR_CHROOT}$chroot_name${COLOR_RESET}] }${PS1}"
96 PS1="${COLOR_RESET}${PS1}"
98 # If the command-not-found package is installed, use it
99 if [ -r /etc/bash_command_not_found ]; then
100 . /etc/bash_command_not_found
101 elif [ -x /usr/lib/command-not-found ]; then
102 function command_not_found_handle {
103 # Check because c-n-f could've been removed in the meantime
104 if [ -x /usr/lib/command-not-found ]; then
105 /usr/bin/python /usr/lib/command-not-found -- $1
113 # Common command aliases
114 alias ","="clear && logout"
119 alias "lasth"="last | head -n \`expr \\\$LINES - 2\`"
121 # Aliases for screen(1), if installed
122 type -p screen >/dev/null 2>&1
123 if [ $? -eq 0 ]; then
125 alias "sr"="screen -dr"
126 alias "sx"="screen -x"
129 # less(1) filter, if available
130 type -p lesspipe >/dev/null 2>&1 && eval `lesspipe`
132 # Initialize ccache(1), if installed
133 if [ -d "/usr/lib/ccache" ]; then
134 PATH="/usr/lib/ccache:$PATH"
135 # Set the cache directory to local storage, if available
136 [ -w "/usr/local/home/$USER" ] \
137 && export CCACHE_DIR="/usr/local/home/$USER/.ccache"
140 # Setup slrn(1) and cleanscore(1), if installed
141 type -p cleanscore >/dev/null 2>&1
142 [ $? -eq 0 ] && alias slrn="cleanscore -f ~/.slrnscore && slrn"
144 # Enable color support of ls(1) and also add handy aliases
145 if [ "$TERM" != "dumb" ]; then
146 type -p dircolors >/dev/null 2>&1 && eval `dircolors -b`
147 ls --color / >/dev/null 2>&1
148 if [ $? -eq 0 ]; then
150 alias ls="ls --color=auto -F"
152 ls -G / >/dev/null 2>&1
153 if [ $? -eq 0 ]; then
160 # If this is an xterm set the title to user@host:dir
163 PROMPT_COMMAND='printf "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
169 # Source local files, if readable
170 [ -r "/etc/bashrc.local" ] && source /etc/bashrc.local
171 [ -r "/etc/bash.bashrc.local" ] && source /etc/bash.bashrc.local
172 [ -r "/var/lib/$ME/bash.bashrc" ] && source /var/lib/$ME/bash.bashrc