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| \
37 # colors for shell prompt etc.
38 COLOR_RESET="\[\e[0m\]"
39 COLOR_PREPOSTTXT="\[\e[1;37m\]"
40 COLOR_USER="\[\e[0;4m\]"
41 COLOR_AT="\[\e[0;37m\]"
42 COLOR_HOST="\[\e[0;4m\]"
43 COLOR_COLON="\[\e[0;37m\]"
45 COLOR_PROMPT_USER="\[\e[1;32m\]"
46 COLOR_PROMPT_ROOT="\[\e[1;31m\]"
47 COLOR_VCS="\[\e[1;33m\]"
49 # colors for less(1) pager
50 export LESS_TERMCAP_mb=$'\E[1;33m'
51 export LESS_TERMCAP_md=$'\E[1;31m'
52 export LESS_TERMCAP_me=$'\E[0m'
53 export LESS_TERMCAP_se=$'\E[0m'
54 export LESS_TERMCAP_so=$'\E[1;33;44m'
55 export LESS_TERMCAP_ue=$'\E[0m'
56 export LESS_TERMCAP_us=$'\E[1;32m'
62 echo "${P/???????????????????????????????*/${P:0:8}...${P: -20}}"
65 PS1="${COLOR_PREPOSTTXT}${PS1_BEGIN:-<}"
67 || PS1="${PS1}${COLOR_USER}\u${COLOR_AT}@"
68 PS1="${PS1}${COLOR_HOST}\h"
69 PS1="${PS1}${COLOR_COLON}:"
70 PS1="${PS1}${COLOR_PATH}\$(PS1_Path)"
71 PS1="${PS1}${COLOR_PREPOSTTXT}${PS1_END:->}${COLOR_RESET} "
73 && PS1="${PS1}${COLOR_PROMPT_ROOT}\\\$${COLOR_RESET} " \
74 || PS1="${PS1}${COLOR_PROMPT_USER}\\\$${COLOR_RESET} "
75 [ "\$(type -t __git_ps1)" ] \
76 && PS1="\$(__git_ps1 '(${COLOR_VCS}%s${COLOR_RESET}) ')${PS1}"
77 PS1="${chroot_name:+[${COLOR_CHROOT}$chroot_name${COLOR_RESET}] }${PS1}"
78 PS1="${COLOR_RESET}${PS1}"
80 # Enable bash completion, if available
81 [ -z "$BASH_COMPLETION" -a -r /etc/bash_completion ] \
82 && source /etc/bash_completion
83 [ -z "$BASH_COMPLETION" -a -r /opt/homebrew/etc/bash_completion ] \
84 && source /opt/homebrew/etc/bash_completion
85 [ -z "$BASH_COMPLETION" -a -r /opt/local/etc/bash_completion ] \
86 && source /opt/local/etc/bash_completion
88 # If the command-not-found package is installed, use it
89 if [ -r /etc/bash_command_not_found ]; then
90 . /etc/bash_command_not_found
91 elif [ -x /usr/lib/command-not-found ]; then
92 function command_not_found_handle {
93 # Check because c-n-f could've been removed in the meantime
94 if [ -x /usr/lib/command-not-found ]; then
95 /usr/bin/python /usr/lib/command-not-found -- $1
103 # Common command aliases
104 alias ","="clear && logout"
109 alias "lasth"="last | head -n \`expr \\\$LINES - 2\`"
111 # Aliases for screen(1), if installed
112 type -p screen >/dev/null 2>&1
113 if [ $? -eq 0 ]; then
115 alias "sr"="screen -dr"
116 alias "sx"="screen -x"
119 # less(1) filter, if available
120 type -p lesspipe >/dev/null 2>&1 && eval `lesspipe`
122 # Initialize ccache(1), if installed
123 if [ -d "/usr/lib/ccache" ]; then
124 PATH="/usr/lib/ccache:$PATH"
125 # Set the cache directory to local storage, if available
126 [ -w "/usr/local/home/$USER" ] \
127 && export CCACHE_DIR="/usr/local/home/$USER/.ccache"
130 # Setup slrn(1) and cleanscore(1), if installed
131 type -p cleanscore >/dev/null 2>&1
132 [ $? -eq 0 ] && alias slrn="cleanscore -f ~/.slrnscore && slrn"
134 # Enable color support of ls(1) and also add handy aliases
135 if [ "$TERM" != "dumb" ]; then
136 type -p dircolors >/dev/null 2>&1 && eval `dircolors -b`
137 ls --color / >/dev/null 2>&1
138 if [ $? -eq 0 ]; then
140 alias ls="ls --color=auto -F"
142 ls -G / >/dev/null 2>&1
143 if [ $? -eq 0 ]; then
150 # If this is an xterm set the title to user@host:dir
153 PROMPT_COMMAND='printf "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
159 # Source local files, if readable
160 [ -r "/etc/bashrc.local" ] && source /etc/bashrc.local
161 [ -r "/etc/bash.bashrc.local" ] && source /etc/bash.bashrc.local
162 [ -r "/var/lib/$ME/bash.bashrc" ] && source /var/lib/$ME/bash.bashrc