# Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi shopt -s dotglob shopt -s checkwinsize shopt -s cdspell shopt -s cmdhist shopt -s extglob shopt -u mailwarn # Turn off new mail notification unset MAILCHECK VISUAL="vim" EDITOR=${VISUAL} BROWSER=mozilla PAGER=less eval $(dircolors -b) #export CDPATH=".:~" export HISTIGNORE="&;ls" stty erase ^? alias less="less -rfsm" alias e="vim" alias ..="cd .." alias bt="/usr/bin/btdownloadcurses.py --max_uploads 1 --responsefile" ################################################################################ # set default prompt if [ $TERM = "linux" ]; then PS1="\[\033[1;31m\]\u\[\033[1;37m\]@\[\033[1;32m\]\h\[\033[1;37m\]:\[\033[0;37m\]\w\n\[\033[0;1;30m\]\t\[\033[1;37m\] \\$\[\033[0m\] " else PS1="\[\e]2;\u@\h:\w\a\\]\[\033[1;31m\]\u\[\033[1;37m\]@\[\033[1;32m\]\h\[\033[1;37m\]:\[\033[0;37m\]\w\n\[\033[0;1;30m\]\t\[\033[1;37m\] \\$\[\033[0m\] " fi ################################################################################ function simple-prompt() { PS1='[\t \u@\h \W]$ '; } function cl() { cd $1; ls; } function mdcd() { mkdir $1; cd $1; } function tarball() { tar czf $1.tar.gz $1 & } function date-stamp() { date +%Y%m%d } # Remove all characters that need be escaped from a string function remove_annoying_chars() { echo $(echo $1 | tr -d "[\`\:\?\!\",']" | tr "[()\ ]" _ | tr "[A-Z]" "[a-z]" | tr -s "_*" "_" | sed "s/[\&+]/and/g") } # Remove all characters that need be escaped from all files in current dir function fix-filenames() { for f in *; do mv "$f" "$(remove_annoying_chars "$f")" &> /dev/null done } # Find a file with a pattern in name # Usage: ff function ff() { find . -type f -iname '*'$*'*' } # Find a file with pattern $1 in name and Execute $2 on it # Usage: fe function fe() { find . -type f -iname '*'$1'*' -exec "${2:-file}" {} \; } function my-ps() { ps $@ x -u $USER -o pid,%cpu,%mem,command | grep -v "ps" | sort -n } # Repeat a command n times # Usage: repeat function repeat() { local i max max=$1; shift; for ((i=1; i <= max ; i++)); do # --> C-like syntax eval "$@"; done } # root user stuff if [ "`id -u`" = "0" ]; then alias syslog='tail -f /var/log/syslog' alias secure='tail -f /var/log/secure' alias messages='tail -f /var/log/messages' alias access_log='tail -f /var/log/apache/access_log' alias error_log='tail -f /var/log/apache/error_log' alias csyslog='less /var/log/syslog' alias csecure='less /var/log/secure' alias cmessages='less /var/log/messages' alias caccess_log='less /var/log/apache/access_log' alias cerror_log='less /var/log/apache/error_log' PS1="\[\033[1;31m\]\u@\h:\[\033[0;31m\]\w\n\[\033[0;1;30m\]\t \[\033[1;31m\]\\$\[\033[0m\] " fi # XFree86 Settings # (this does not belong here; figure out better way to do this) if [ $DISPLAY = ":0.0" ]; then xset b off 2> /dev/null setxkbmap -option "ctrl:swapcaps" 2> /dev/null fi # Source local configurations for file in ~/sys/config/*.sh; do if [ -x $file ]; then source $file fi done source ~/.keychain/$(hostname)-sh