commit bffe5d280e71d76d08a3a1e01469275ca8b16470 Author: Alejandro Mery Date: Wed Sep 17 11:58:29 2008 +0200 Added .bash stuff diff --git a/.bash/prompts.in b/.bash/prompts.in new file mode 100644 index 0000000..e37868d --- /dev/null +++ b/.bash/prompts.in @@ -0,0 +1,46 @@ +function eliteprompt() { + local NOCOLOR='\[\033[0m\]' + local BLUE='\[\033[1;34m\]' + local CYAN='\[\033[1;36m\]' + + local ps1='' + local ps1a='' + + local TTY='$( TTY=`tty` && echo ${TTY:5} )' + local TITLEBAR='' + + case $TERM in + putty|xterm*|rxvt) + TITLEBAR='\[\033]0;\u@\h ('$TTY') \w\007\]' ;; + *) + TITLEBAR='' ;; + esac + + # timestamp + ps1a='$( date +%H:%M )' + ps1=$ps1$BLUE'['$CYAN$ps1a$BLUE']' + + # user/host + ps1a=$NOCOLOR\\u$CYAN\@$NOCOLOR\\h + + # workdir and tty + ps1=$ps1' '$BLUE\[$ps1a$CYAN\($NOCOLOR$TTY$CYAN\)$NOCOLOR\\W$BLUE\] + + # and the prompt + ps1=$ps1$CYAN\\$ + export PS1=$TITLEBAR$ps1$NOCOLOR' ' +} + +function dummyprompt() { + export PS1='[$( date +%H:%M )] [\u@\h:\w]\$ ' +} + +function ircprompt() { + export PS1='[$( date +%H:%M )] <$( if [ $UID -eq 0 ]; then echo "@"; fi )\u>' +} + +eliteprompt + +unset eliteprompt +unset dummyprompt +unset ircprompt diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..c3d1a21 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,4 @@ +#!/bin/sh + +echo ".bash_profile -> .bashrc" >&2 +[ -s "$HOME/.bashrc" ] && source "$HOME/.bashrc" diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..1bfaf59 --- /dev/null +++ b/.bashrc @@ -0,0 +1,74 @@ +#!/bin/bash -x + +echo "loading .bashrc" >&2 + +# $HOME/bin +# + +if [ ! -d "$HOME/bin" ]; then + set- x + mkdir "$HOME/bin" + if [ "$PATH" == "${PATH//$HOME\/bin/}" ]; then + export PATH="$HOME/bin:$PATH" + fi + set +x +fi + +# GPG +# +if [ ! -x "$(type -p gpg-agent)" ]; then + : +elif test -f "$HOME/.gpg-agent-info" && + kill -0 $(cut -d: -f2 "$HOME/.gpg-agent-info" 2> /dev/null ) 2> /dev/null; then + + . "$HOME/.gpg-agent-info" + + export GPG_TTY=$(tty) +else + eval $(gpg-agent --daemon --log-file "$HOME/.gpg-agent.log" \ + --write-env-file "$HOME/.gpg-agent-info" 2> /dev/null) + + export GPG_TTY=$(tty) +fi + +# ssh wrapper +# +if [ -x $HOME/bin/ssh ]; then + export CVS_SSH="$HOME/bin/ssh" + export SVN_SSH="$HOME/bin/ssh" + export GIT_SSH="$HOME/bin/ssh" +else + export CVS_RSH=ssh +fi + +# other apps chosen by env +# +export BROWSER=links +export EDITOR=vim + +# tweak your bash +# +export HISTFILESIZE=50 +export HISTCONTROL=ignoredups + +# interactive prompt +if [ "$PS1" ]; then + echo "TERM:$TERM" + + # support resize, please + shopt -s checkwinsize + + # get a good $PS1 + [ -f $HOME/.bash/prompt.in ] && . $HOME/.bash/prompt.in + + # aliases + # + alias ls='ls --color=auto' + alias l='ls -avhlF' + + [ "$(type -t ll)" = alias ] && unalias ll + function ll() { ls -avhlF $* | less; } +fi + +# local settings +[ -f $HOME/.bash/local.in ] && . $HOME/.bash/local.in