Skip to content

Instantly share code, notes, and snippets.

@orymate
Created June 14, 2010 10:27
Show Gist options
  • Save orymate/437524 to your computer and use it in GitHub Desktop.
Save orymate/437524 to your computer and use it in GitHub Desktop.
if [ ! "$PS1" ]; then
exit 0;
fi
alias ls="ls --color=auto"
case ${TERM} in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
alias_ssh () { echo -ne "\033]2;$*\007"; "ssh" $*; }
alias ssh=alias_ssh
;;
screen)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
;;
esac
alias cp="cp --interactive"
alias mv="mv --interactive"
# switch to temporary directories http://www.erat.org/doc/bashrc_recipes.html
temp_dir() {
gothere=$1
base=$HOME/temp
create=1
if test "$2"; then
if echo "$2" | egrep -q '^[0-9]+$' && test $2 -gt 0; then
dir=$base/`date -d "$2 days ago" +%Y%m%d`
create=0
else
dir="$base/$2"
fi
else
dir=$base/`date +%Y%m%d`
fi
if [ $create == 1 ] && test \! -e "$dir"; then
mkdir -p "$dir"
fi
if [ $gothere == 1 ]; then
cd $dir
else
echo $dir
fi
ln -sTf $dir ~/t
}
t() { temp_dir 1 $1; }
tp() { temp_dir 0 $1; }
tn() { nautilus `tp`; }
alias gerp=grep
export PATH="$PATH:/home/maat/scripts"
alias df='LANG=C df'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment