]> git.donarmstrong.com Git - home-base.git/blob - .bashrc
ignore cache
[home-base.git] / .bashrc
1 # ~/.bashrc: executed by bash(1) for non-login shells.
2 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
3 # for examples
4
5 # If running interactively, then:
6 if [ "$PS1" ]; then
7
8     # don't put duplicate lines in the history. See bash(1) for more options
9     export HISTCONTROL=ignoredups
10     if [ -x ~/bin/sane_editor ]; then
11         EDITOR=~/bin/sane_editor;
12     elif [ -x /usr/bin/jed ]; then
13         EDITOR="/usr/bin/jed";
14     elif [ -x /usr/bin/vi ]; then
15         EDITOR="/usr/bin/vi";
16     fi;
17
18     if [ -n "$EDITOR" ]; then
19         export EDITOR;
20     fi;
21     # bts debian options
22
23     if [ -e bin/faf ]; then
24         complete -F _command faf
25     fi;
26
27     export DEBEMAIL="don@debian.org"
28     export DEBHOME="$(eval 'echo' '~/projects/debian')"
29
30     # enable color support of ls and also add handy aliases
31     eval `dircolors -b`
32     alias ls='ls --color=auto'
33     alias gr='gimp-remote'
34     alias emc='sane_editor'
35
36     alias svn-b="svn-buildpackage --svn-builder 'pdebuild --buildresult ..' --svn-ignore-new"
37
38     # set a fancy prompt
39     #printf '\33]2;%s\007'
40     
41     # See if we're in a chroot
42     if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
43         debian_chroot=$(cat /etc/debian_chroot)
44     fi
45
46     # we want to set the color based on what machine we're on
47     # if it's a remote, SSH_CONNECTION will be set
48     # set variable identifying the chroot you work in (used in the prompt below)
49     
50     # disable terminal bell
51     bind 'set bell-style none'
52
53     if [ -n "$SSH_CONNECTION" -o -n "$SSH_CLIENT" ]; then
54         # figure out what color to use
55         COLOR=$(hostname|md5sum|perl -ne 'if (/^([a-f\d]{8})/) {
56               my $num = unpack(q(L),pack(q(H*),$1));
57               my @col = map {(qq(0;${_}m),qq(1;${_}m))} 31..37;
58               my $col = $col[$num % @col];
59               if ($col eq q(0;36m)) {
60                  $col = q(1;30m);
61               }
62               print $col;
63               }')
64         PS1="${debian_chroot:+($debian_chroot)}\[\033[$COLOR\]\h \[\033[0;36m\]\t \w$\[\033[0m\] "
65         unset COLOR
66     else
67         PS1="${debian_chroot:+($debian_chroot)}\[\033[0;36m\]\h \t \w$\[\033[0m\] "
68     fi;
69     # \[\033[1;36m\][\w]\n\[\033[0;36m\][\h|\t]$ \[\033[0m\]
70
71     # make sure the term we're using exists in the termcap
72     TOEOPT='-a'
73     if ! toe $TOEOPT >/dev/null 2>&1; then
74         TOEOPT=''
75     fi;
76     if ! toe $TOEOPT|grep -q "^$TERM    "; then
77         # if it doesn't, try to switch
78         case $TERM in
79             rxvt*)
80                 TERM="rxvt"
81                 ;;
82             xterm*)
83                 TERM="xterm"
84                 ;;
85             *)
86                 ;;
87         esac
88         export TERM;
89     fi;
90     # If this is an xterm set the title to user@host:dir
91     case $TERM in
92         screen|xterm*)
93             PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
94             ;;
95         rxvt*)
96             PROMPT_COMMAND='echo -ne "\033]2;${USER}@${HOSTNAME}: ${PWD}\007"'
97             ;;
98
99         *)
100             ;;
101     esac
102
103     # enable programmable completion features (you don't need to enable
104     # this, if it's already enabled in /etc/bash.bashrc).
105     if [ -f /etc/bash_completion ]; then
106       . /etc/bash_completion;
107     fi;
108
109     # set up ssh-agent
110     if which ssh-agent >/dev/null && [ -d ~/.ssh ] &&  \
111         [ -z "$SSH_CONNECTION" ] &&  [ -z "$SSH_CLIENT" ]; then 
112 #       for 
113         if [ -e ~/.ssh/ssh_agent_info ] && \
114             [ -n "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" ] && \
115             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" >/dev/null 2>&1; then
116             . ~/.ssh/ssh_agent_info > /dev/null
117         elif [ -e ~/.ssh/ssh_agent_info_$(hostname) ] && \
118             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info_$(hostname))" >/dev/null 2>&1; then
119             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
120         else
121             ssh-agent -s > ~/.ssh/ssh_agent_info_$(hostname)
122             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
123         fi;
124     fi;
125     
126     alias aumix2='aumix -d /dev/mixer1 -I'
127     if locale -a |grep -qi en_US.utf8; then
128         LANG="en_US.UTF-8"
129     else
130         LANG=C
131     fi;
132     export LANG
133     
134     # If we're running on liszt, include /var/list/.bin in the path
135     if [ "$(hostname)" == "liszt" ] && [ -d /var/list/.bin ]; then
136         PATH="/var/list/.bin:$PATH"
137     fi;
138     export PATH="$(getent passwd $(id -u)|awk -F: '{print $6}')/bin:$PATH"
139     
140     if [ ! -e ~/tmp ]; then
141         mkdir ~/tmp;
142     fi;
143     export TMPDIR="$(echo ~/tmp)";
144
145 #     if [ -n "$(which devtodo)" ]; then
146 #       for a in tda tdd tde; do
147 #           alias "s${a}"="STODO_NO_COMMIT=1 $a"
148 #       done;
149
150 #       TODO_OPTIONS="--timeout --summary"
151
152         cd ()
153         {
154             # use pushd instead of cd
155             if [ -z "$1" ] || [ "$1" == "-" ]; then
156                 builtin cd "$@"; # && [ -r .todo ] && devtodo ${TODO_OPTIONS};
157             else
158                 builtin pushd "$@" >/dev/null; # && [ -r .todo ] && devtodo ${TODO_OPTIONS};
159             fi;
160         }
161
162 #       pushd ()
163 #       {
164 #             builtin pushd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
165 #       }
166 #       
167 #       popd ()
168 #       {
169 #             builtin popd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
170 #       }              
171         
172         # Run todo initially upon login
173 #       devtodo ${TODO_OPTIONS}
174 #     fi;
175 fi