]> git.donarmstrong.com Git - home-base.git/blob - .bashrc
* Switch to a TERM that exists if the one we're using doesn't
[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-2.2'
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     PS1="\[\033[0;36m\]\h \t \w$\[\033[0m\] "
36     # \[\033[1;36m\][\w]\n\[\033[0;36m\][\h|\t]$ \[\033[0m\]
37
38     # make sure the term we're using exists in the termcap
39     if ! toe -a|grep -q "^$TERM "; then
40         # if it doesn't, try to switch
41         case $TERM in
42             rxvt*)
43                 TERM="rxvt"
44                 ;;
45             xterm*)
46                 TERM="xterm"
47                 ;;
48             *)
49                 ;;
50         esac
51         export TERM;
52     fi;
53     # If this is an xterm set the title to user@host:dir
54     case $TERM in
55         screen|xterm*)
56             PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
57             ;;
58         rxvt*)
59             PROMPT_COMMAND='echo -ne "\033]2;${USER}@${HOSTNAME}: ${PWD}\007"'
60             ;;
61
62         *)
63             ;;
64     esac
65
66     # enable programmable completion features (you don't need to enable
67     # this, if it's already enabled in /etc/bash.bashrc).
68     if [ -f /etc/bash_completion ]; then
69       . /etc/bash_completion;
70     fi;
71
72     # set up ssh-agent
73     if which ssh-agent >/dev/null && [ -d ~/.ssh ]; then
74 #       for 
75         if [ -e ~/.ssh/ssh_agent_info ] && \
76             [ -n "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" ] && \
77             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info)" >/dev/null 2>&1; then
78             . ~/.ssh/ssh_agent_info > /dev/null
79         elif [ -e ~/.ssh/ssh_agent_info_$(hostname) ] && \
80             kill -0 "$(awk -F '[=;]' '/^SSH_AGENT_PID/{print $2}' ~/.ssh/ssh_agent_info_$(hostname))" >/dev/null 2>&1; then
81             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
82         else
83             ssh-agent -s > ~/.ssh/ssh_agent_info_$(hostname)
84             . ~/.ssh/ssh_agent_info_$(hostname) > /dev/null
85         fi;
86     fi;
87     
88     alias aumix2='aumix -d /dev/mixer1 -I'
89     if locale -a |grep -qi en_US.utf8; then
90         LANG="en_US.UTF-8"
91     else
92         LANG=C
93     fi;
94     export LANG
95     export PATH="~/bin:$PATH"
96     if [ ! -e ~/tmp ]; then
97         mkdir ~/tmp;
98     fi;
99     export TMPDIR="$(echo ~/tmp)";
100
101     if [ -n "$(which devtodo)" ]; then
102         for a in tda tdd tde; do
103             alias "s${a}"="STODO_NO_COMMIT=1 $a"
104         done;
105
106         TODO_OPTIONS="--timeout --summary"
107
108         cd ()
109         {
110             builtin cd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
111         }
112
113         pushd ()
114         {
115             builtin pushd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
116         }
117         
118         popd ()
119         {
120             builtin popd "$@" && [ -r .todo ] && devtodo ${TODO_OPTIONS}
121         }              
122         
123         # Run todo initially upon login
124         devtodo ${TODO_OPTIONS}
125     fi;
126 fi