Browse Source

Added .bash stuff

master
Alejandro Mery 16 years ago
commit
bffe5d280e
3 changed files with 124 additions and 0 deletions
  1. +46
    -0
      .bash/prompts.in
  2. +4
    -0
      .bash_profile
  3. +74
    -0
      .bashrc

+ 46
- 0
.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

+ 4
- 0
.bash_profile

@ -0,0 +1,4 @@
#!/bin/sh
echo ".bash_profile -> .bashrc" >&2
[ -s "$HOME/.bashrc" ] && source "$HOME/.bashrc"

+ 74
- 0
.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

Loading…
Cancel
Save