dot-emacs: Finally fix fontification in cpp-messages-mode.
[profile] / bashrc
1 #
2 # $Id: .bashrc,v 1.6 1996/12/08 20:33:42 mdw Exp $
3 #
4 # Bash session things
5 #
6
7 if [ -z "$__mdw_bashrc" ]; then
8
9 __mdw_bashrc=done
10
11 [ -z "$__mdw_profile" -a -r $HOME/.bash_profile ] && . $HOME/.bash_profile
12 [ -r /etc/bashrc ] && . /etc/bashrc
13
14 # --- First of all, set up the prompt string ---
15
16 if [ -t 0 ]; then
17
18 if [ "$TERM" = "dumb" ]; then
19 if (( EUID == 0 )); then PS1="# "; else PS1="\$ "; fi
20 PS2="> "
21 PS4="+ "
22 else
23
24 case "$TERM" in
25 linux*|screen*|xterm*|vt100*)
26 bold='\[\e[1m\]' unbold='\[\e[m\]' nl='\[ \]' ;;
27 *)
28 bold='' unbold='' nl='' ;;
29 esac
30
31 if (( EUID == 0 )); then
32 left="«" right="»"
33 else
34 case $USER in
35 mdw|mwooding)
36 u="" left="[" right="]"
37 ;;
38 *)
39 u="\\u@" left="{" right="}"
40 ;;
41 esac
42 if [ "$__mdw_tty" = "`tty`" ]; then
43 left="<" right=">"
44 else
45 export __mdw_tty="`tty`"
46 fi
47 fi
48
49 if [ -z "$SSH_CLIENT" ] &&
50 [ "$__mdw_sechost" != "`hostname`" ]
51 then
52 sec_l='(' sec_r=')'
53 fi
54
55 PS1="$nl$bold$left$sec_l$u\\h$sec_r \\w$right$unbold"
56 PS2="$PS1 $bold>$unbold "
57 fi
58
59 fi # is stdin a tty?
60
61 # --- Little preferences ---
62
63 notify=1
64 set -b
65 shopt -u cdable_vars
66 shopt -s cdspell
67 shopt -s checkhash
68 shopt -s checkwinsize
69 shopt -s cmdhist
70 shopt -u dotglob
71 shopt -s expand_aliases
72 shopt -s extglob
73 shopt -s histappend
74 shopt -s histreedit
75 shopt -u histverify
76 shopt -s hostcomplete
77 shopt -s huponexit
78 shopt -s interactive_comments
79 shopt -s lithist
80 shopt -u mailwarn
81 shopt -u nocaseglob
82 shopt -u nullglob
83 shopt -s promptvars
84 shopt -u shift_verbose
85 shopt -s sourcepath
86
87 # --- Set the CDPATH ---
88 #
89 # CDPATH=~/src:/usr/src:/usr/lib:/usr/share
90 # dots=..
91 # i=6
92 # while (( i > 0 )); do
93 # CDPATH=$CDPATH:$dots
94 # dots=$dots/..
95 # (( i -= 1 ))
96 # done
97 # CDPATH=$CDPATH:/
98
99 # --- Some colour `ls' support ---
100
101 [ "${TMPDIR+yes}" ] || eval `tmpdir -b`
102 if [ -x /usr/bin/dircolors -o -x /usr/local/bin/dircolors ] &&
103 [ "$TERM" != "dumb" ]; then
104 eval `dircolors -b ~/.dircolors`
105 else
106 unset LS_COLORS
107 fi
108
109 ls () {
110 if [ -t 1 ]; then
111 command ls $LS_OPTIONS ${LS_COLORS+--color=auto} "$@"
112 else
113 command ls "$@"
114 fi
115 }
116
117 # --- Set up some simple aliases ---
118
119 alias cx='chmod a+x'
120 alias which="command -v"
121 alias ssync="rsync -e ssh"
122 alias rootly=$__MDW_ROOTLY
123 alias r=rootly
124 alias re="rootly $EDITOR"
125 alias pstree="pstree -Ghl"
126 alias cdtmp='cd ${TMPDIR-/tmp}'
127 alias pushtmp='pushd ${TMPDIR-/tmp}'
128 alias e="$EDITOR"
129 alias svn="svnwrap svn"
130 alias @="ssh"
131
132 # --- Make `xt' start an xterm, maybe logging into a remote host ---
133
134 xt () {
135 case "$1" in
136 @*)
137 local remote=${1#@} title
138 shift
139 if [ $# -gt 0 ]; then
140 title="xterm [$remote] $1"
141 else
142 title="xterm [$remote]"
143 fi
144 (xterm -title "$title" -e ssh $remote "$@" &)
145 ;;
146 *)
147 (xterm "$@" &)
148 ;;
149 esac
150 }
151
152 # --- Turning on and off core dumps ---
153
154 core () {
155 case "x$1" in
156 xon|xy|xyes)
157 ulimit -Sc `ulimit -Hc`
158 ;;
159 xoff|xn|xno)
160 ulimit -Sc 0
161 ;;
162 x)
163 local l=`ulimit -Sc`
164 case $l in
165 0) echo "Core dumps disabled" ;;
166 unlimited) echo "Core dumps enabled" ;;
167 *) echo "Core dump limit is $l blocks" ;;
168 esac
169 ;;
170 *)
171 echo >&2 "usage: core [yn]"
172 return 1
173 ;;
174 esac
175 }
176
177 # --- Fix `man' under Slowaris ---
178
179 case "$MACHTYPE" in
180 *solaris*)
181 man () {
182 declare -i i=0
183 declare arg
184 declare -a man
185
186 for arg; do
187 case "$arg" in [0-9]*) man[i+=1]="-s" ;; esac
188 man[i+=1]="$arg"
189 done
190 command man "${man[@]}"
191 }
192 ;;
193 esac
194
195 # --- For `root' use -- some simple molly-guards ---
196
197 if (( UID == 0 )); then
198 alias rm='rm -i' cp='cp -i' mv='mv -i'
199 set -o noclobber
200 fi
201
202 fi