]> git.donarmstrong.com Git - home-base.git/blob - .bashrc
add linnode key
[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     export DEBEMAIL="don@debian.org"
24
25     # enable color support of ls and also add handy aliases
26     eval `dircolors -b`
27     alias ls='ls --color=auto'
28     alias gr='gimp-remote'
29     alias emc='sane_editor'
30
31     alias svn-b="svn-buildpackage --svn-builder 'pdebuild --buildresult ..' --svn-ignore-new"
32
33     # set a fancy prompt
34     #printf '\33]2;%s\007'
35     
36     # See if we're in a chroot
37     if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
38         debian_chroot=$(cat /etc/debian_chroot)
39     fi
40
41     # we want to set the color based on what machine we're on
42     # if it's a remote, SSH_CONNECTION will be set
43     # set variable identifying the chroot you work in (used in the prompt below)
44     
45     if [ -n "$SSH_CONNECTION" -o -n "$SSH_CLIENT" ]; then
46         # figure out what color to use
47         COLOR=$(hostname|md5sum|perl -ne 'if (/^([a-f\d]{8})/) {
48               my $num = unpack(q(L),pack(q(h*),$1));
49               my @col = map {(qq(0;${_}m),qq(1;${_}m))} 31..37;
50               my $col = $col[$num%$#col];
51               if ($col eq q(0;36m)) {
52                  $col = q(1;30m);
53               }
54               print $col;
55               }')
56         PS1="${debian_chroot:+($debian_chroot)}\[\033[$COLOR\]\h \[\033[0;36m\]\t \w$\[\033[0m\] "
57         unset COLOR
58     else
59         PS1="${debian_chroot:+($debian_chroot)}\[\033[0;36m\]\h \t \w$\[\033[0m\] "
60     fi;
61     # \[\033[1;36m\][\w]\n\[\033[0;36m\][\h|\t]$ \[\033[0m\]
62
63     # make sure the term we're using exists in the termcap
64     TOEOPT='-a'
65     if ! toe $TOEOPT >/dev/null 2>&1; then
66         TOEOPT=''
67     fi;
68     if ! toe $TOEOPT|grep -q "^$TERM    "; then
69         # if it doesn't, try to switch
70         case $TERM in
71             rxvt*)
72                 TERM="rxvt"
73                 ;;
74             xterm*)
75                 TERM="xterm"
76                 ;;
77             *)
78                 ;;
79         esac
80         export TERM;
81     fi;
82     # If this is an xterm set the title to user@host:dir
83     case $TERM in
84         screen|xterm*)
85             PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
86             ;;
87         rxvt*)
88             PROMPT_COMMAND='echo -ne "\033]2;${USER}@${HOSTNAME}: ${PWD}\007"'
89             ;;
90
91         *)
92             ;;
93     esac
94
95     # enable programmable completion features (you don't need to enable
96     # this, if it's already enabled in /etc/bash.bashrc).
97     if [ -f /etc/bash_completion ]; then
98       . /etc/bash_completion;
99     fi;
100
101     # set up ssh-agent
102     if which ssh-agent >/dev/null && [ -d ~/.ssh ]; then
103 #       for 
104         if [ -e ~/.ssh/ssh_agent_info ] && \
105             [ -n "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" ] && \
106             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" >/dev/null 2>&1; then
107             . ~/.ssh/ssh_agent_info > /dev/null
108         elif [ -e ~/.ssh/ssh_agent_info_$(hostname) ] && \
109             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info_$(hostname))" >/dev/null 2>&1; then
110             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
111         else
112             ssh-agent -s > ~/.ssh/ssh_agent_info_$(hostname)
113             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
114         fi;
115     fi;
116     
117     alias aumix2='aumix -d /dev/mixer1 -I'
118     if locale -a |grep -qi en_US.utf8; then
119         LANG="en_US.UTF-8"
120     else
121         LANG=C
122     fi;
123     export LANG
124     export PATH="~/bin:$PATH"
125     if [ ! -e ~/tmp ]; then
126         mkdir ~/tmp;
127     fi;
128     export TMPDIR="$(echo ~/tmp)";
129
130     if [ -n "$(which devtodo)" ]; then
131         for a in tda tdd tde; do
132             alias "s${a}"="STODO_NO_COMMIT=1 $a"
133         done;
134
135         TODO_OPTIONS="--timeout --summary"
136
137         cd ()
138         {
139             builtin cd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
140         }
141
142         pushd ()
143         {
144             builtin pushd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
145         }
146         
147         popd ()
148         {
149             builtin popd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
150         }              
151         
152         # Run todo initially upon login
153         devtodo ${TODO_OPTIONS}
154     fi;
155 fi