3 # $Id: .bashrc,v 1.6 1996/12/08 20:33:42 mdw Exp $
8 if [ -z "$__mdw_bashrc" ]; then
12 [ -z "$__mdw_profile" -a -r $HOME/.bash_profile ] && . $HOME/.bash_profile
13 [ -r /etc/bashrc ] && . /etc/bashrc
15 # --- First of all, set up the prompt string ---
19 if [ "$TERM" = "dumb" ]; then
20 if (( EUID == 0 )); then PS1="# "; else PS1="\$ "; fi
26 linux*|screen*|xterm*|vt100*)
27 bold='\[
\e[1m\]' unbold='\[
\e[m\]' nl='\[
\r\]' ;;
29 bold='' unbold='' nl='' ;;
32 if (( EUID == 0 )); then
37 u="" left="[" right="]"
40 u="\\u@" left="{" right="}"
43 if [ "$__mdw_tty" = "`tty`" ]; then
46 export __mdw_tty="`tty`"
50 if [ -z "$SSH_CLIENT" ] &&
51 [ "$__mdw_sechost" != "`hostname`" ]
56 PS1="$nl$bold$left$sec_l$u\\h$sec_r \\w$right$unbold"
57 PS2="$PS1 $bold>$unbold "
62 # --- Little preferences ---
72 shopt -s expand_aliases
79 shopt -s interactive_comments
85 shopt -u shift_verbose
88 # --- Set the CDPATH ---
90 # CDPATH=~/src:/usr/src:/usr/lib:/usr/share
93 # while (( i > 0 )); do
94 # CDPATH=$CDPATH:$dots
100 # --- Some colour `ls' support ---
102 [ "${TMPDIR+yes}" ] || eval `tmpdir -b`
103 if [ -x /usr/bin/dircolors -o -x /usr/local/bin/dircolors ] &&
104 [ "$TERM" != "dumb" ]; then
105 eval `dircolors -b ~/.dircolors`
112 command ls $LS_OPTIONS ${LS_COLORS+--color=auto} "$@"
118 # --- Set up some simple aliases ---
121 alias which="command -v"
122 alias ssync="rsync -e ssh"
123 alias rootly=$__MDW_ROOTLY
125 alias re="rootly $EDITOR"
126 alias pstree="pstree -Ghl"
127 alias cdtmp='cd ${TMPDIR-/tmp}'
128 alias pushtmp='pushd ${TMPDIR-/tmp}'
130 alias svn="svnwrap svn"
133 [ -r /etc/bash_completion ] && . /etc/bash_completion
134 [ -r $HOME/.bash_completion ] && . $HOME/.bash_completion
136 # --- Make `xt' start an xterm, maybe logging into a remote host ---
141 local remote=${1#@} title
143 if [ $# -gt 0 ]; then
144 title="xterm [$remote] $1"
146 title="xterm [$remote]"
148 (xterm -title "$title" -e ssh $remote "$@" &)
156 # --- Turning on and off core dumps ---
161 ulimit -Sc `ulimit -Hc`
169 0) echo "Core dumps disabled" ;;
170 unlimited) echo "Core dumps enabled" ;;
171 *) echo "Core dump limit is $l blocks" ;;
175 echo >&2 "usage: core [yn]"
181 # --- Turning on and off path hacks ---
184 local pathvar export dir val
186 1) pathvar=PATH dir=$1 export="export PATH";;
187 2) pathvar=$1 dir=$2 export=:;;
188 *) echo >&2 "Usage: $0 [VAR] DIR";;
190 eval "val=\$$pathvar"
195 eval "$pathvar=\$val"
200 local pathvar export dir val
202 1) pathvar=PATH dir=$1 export="export PATH";;
203 2) pathvar=$1 dir=$2 export=:;;
204 *) echo >&2 "Usage: $0 [VAR] DIR";;
206 eval "val=\$$pathvar"
209 :"$dir":*) val=${val#$dir:} ;;
210 *:"$dir":) val=${val%:$dir} ;;
211 *:"$dir":*) val=${val/:$dir:/:} ;;
213 eval "$pathvar=\$val"
218 if [ $# -eq 0 ]; then
223 echo ${e#$HOME/bin/hacks/}
231 while [ $# -gt 0 ]; do
250 dir=$HOME/bin/hacks/$hack
252 echo "$0: path hack $hack not found"
255 case "$arg,$force,:$PATH:" in
257 path-remove path "$dir"
260 path-remove path "$dir"
271 if [ $# -eq 0 ]; then
279 # --- Fix `man' under Slowaris ---
289 case "$arg" in [0-9]*) man[i+=1]="-s" ;; esac
292 command man "${man[@]}"
297 # --- For `root' use -- some simple molly-guards ---
299 if (( UID == 0 )); then
300 alias rm='rm -i' cp='cp -i' mv='mv -i'
304 [ -f "$HOME/.bashrc-local" ] && . "$HOME/.bashrc-local"