Skip to content

Instantly share code, notes, and snippets.

@jamesmehorter
Created February 26, 2013 16:27
Show Gist options
  • Save jamesmehorter/5039818 to your computer and use it in GitHub Desktop.
Save jamesmehorter/5039818 to your computer and use it in GitHub Desktop.
.bashrc
#!/bin/sh
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output.
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]]; then
# Shell is non-interactive. Be done now
return
fi
# Shell is interactive. It is okay to produce output at this point,
# though this example doesn't produce any. Do setup for
# command-line interactivity.
# Change the window title of X terminals
case $TERM in
xterm*|rxvt|Eterm|eterm)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
;;
screen)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
;;
esac
export PATH="/opt/local/bin:/opt/local/sbin:/opt/local/lib/postgresql90/bin:$PATH"
#. ~/.profile
###############
# variables #
###############
export EDITOR="vim"
export PAGER="less"
export BROWSER="firefox"
export PS1="\[\033[0;31m\]\l \[\033[1;33m\]\d \[\033[1;36m\]\t \[\033[0;32m\]|\w|\[\033[0m\]\n\u\\$ "
#############
# aliases #
#############
alias ls='ls -AF'
alias ll='ls -l'
alias du='du -h'
alias df='df -h'
alias calc='bc'
alias tetris='tetris-bsd -l9 -p'
#alias info='pinfo'
#alias man='pinfo -m'
export BREAK_CHARS="\"#'(),;\`\\|!?[]{}"
alias sbcl-rl="rlwrap -b \$BREAK_CHARS sbcl"
###############
# functions #
###############
newscript ()
{
if [ -z "$1" ]; then
echo "usage: newscript <new file name>"
return
fi
if [ -e "$1" ]; then
echo "file '$1' allready exists"
return
fi
case "$1" in
*.pl)
echo "#!/usr/bin/perl -w" > $1
;;
*.py)
echo "#!/usr/bin/python" > $1
;;
*.lua)
echo "#!/usr/bin/lua" > $1
;;
*)
echo \#\!/bin/sh > $1
;;
esac
echo >> $1
echo >> $1
chmod 755 $1
$EDITOR $1
}
unrpm ()
{
if [ -z "$1" ]; then
echo "usage: unrpm <file.rpm>"
return
fi
rpm2cpio $1 | cpio -div
}
asm ()
{
[[ "$1" != *.s ]] && echo "usage: `basename $0` file.s" && return
EXE=`basename $1 .s`
OBJ=$EXE.o
as $1 -o $OBJ && ld -s $OBJ -o $EXE
}
# bash-completion:
[ -f /etc/profile.d/bash-completion.sh ] && . /etc/profile.d/bash-completion.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment