update bashrc
[lab.git] / TipAndDoc / .bashrc
index bece347..1306c0c 100644 (file)
@@ -1,18 +1,9 @@
-# enable programmable completion features (you don't need to enable
-# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
-# sources /etc/bash.bashrc).
-if [ -f /etc/bash_completion ]; then
-    . /etc/bash_completion
-fi
 
 umask 022   # create new file with '644'
 ulimit -c 0 # no dump core
 export PAGER=less
 export LESS='-FRX -i -P ?f%f:(stdin).  ?lb%lb?L/%L..  [?eEOF:?pb%pb\%..]'
 
-HISTSIZE=50000
-HISTFILESIZE=50000
-
 set -o notify   # notify end of background job immediately
 
 shopt -s histappend     # append command history instead of overwrite
@@ -32,23 +23,28 @@ function I {
     if [ "$1" ]; then history | grep "$@"; else history 30; fi
 }
 
-if [ -f $BASH_COMPLETION_DIR/git -o -f $BASH_COMPLETION_COMPAT_DIR/git ]; then
-    export PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1)\$ '
+if [ -f /usr/share/git/completion/git-prompt.sh ]; then
+    source /usr/share/git/completion/git-prompt.sh
+    export PS1='\u@\h:\w$(__git_ps1)\$ '
 else
-    export PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
+    export PS1='\u@\h:\w\$ '
 fi
 
-if [ -d $HOME/bin -a `echo $PATH | grep -c $HOME/bin` -eq 0 ]; then
-    export PATH=$PATH:$HOME/bin
+agent="$HOME/.ssh/ssh-agent-$USER"
+if [ -S "$SSH_AUTH_SOCK" ]; then
+    case $SSH_AUTH_SOCK in
+    /tmp/*/agent.[0-9]*)
+        ln -snf "$SSH_AUTH_SOCK" $agent && export SSH_AUTH_SOCK=$agent
+    esac
+elif [ -S $agent ]; then
+    export SSH_AUTH_SOCK=$agent
+else
+    echo "no ssh-agent"
 fi
 
-function svnst {
-    svn st $@ | grep "^[^?]"
-}
-
-function hexcmp {
-    cmp -l "$@" | awk '{printf "%08X %02X %02X\n", $1-1, strtonum(0$2), strtonum(0$3)}'
-}
+if [ -d "$HOME/bin" ]; then
+    PATH="$HOME/bin:$PATH"
+fi
 
 alias vi='vim'
 alias sudo='sudo -H '