Fichier de resource .bashrc redefinissant
rm (deplacement vers ~/.wastebasket)
# -*- sh -*-
#
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# User preferences
export NAME="Laurent Mazet"
export EMAIL="$NAME <${NAME// /.}@ercom.fr>"
export REPLYTO=$EMAIL
export SIGNATURE=".signature"
export ORGANIZATION="Ercom"
export HOME=${HOME//\.\/}
# Don't put duplicate lines in the history.
export HISTCONTROL=ignoredups
# Check the window size after each command and, if necessary,
# Update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
# Enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
eval `dircolors -b`
alias ls='\ls -CF --color=auto'
else
alias ls='\ls -CF'
fi
# some more ls aliases
alias ll='ls -l'
alias la='ls -a'
alias l='ls -CAF'
# miscellaneous aliases
alias cls='clear'
alias dir='ls --format=vertical'
alias del='\rm -i'
alias deldir='\rm -r'
alias grep='\grep --color'
alias g='grep'
alias copy='cp'
alias ren='mv'
# set a fancy prompt
case $TERM in
xterm*|rxvt*) PS1='\[\033[01;34m\]\u\[\033[00m\]@\[\033[01;33m\]\h\[\033[00m\]:\[\033[01;32m\]\w\[\033[00m\] \$ ';;
*) PS1='\u@\h:\w \$ ' ;;
esac
# If this is an xterm set the title to user@host:dir
case $TERM in
xterm*|rxvt*) PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/#$HOME/~}\007"' ;;
*) ;;
esac
# Environment variables
export BLOCKSIZE=1k
export EDITOR=vim
export GZIP=--best
export LESS=FMISRX
export MACHINE="`uname -rs`"
export PAGER=less
[ -d $HOME/bin ] && [[ ! $PATH =~ $HOME/bin ]] && \
export PATH=$HOME/bin:$PATH
#export TOP=-s1
export VISUAL=vim
# Malloc checker
#export MALLOC_CHECK_=2
# Core size
ulimit -c unlimited
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
## libcurl options
[ -f $HOME/.libcurlrc ] && source $HOME/.libcurlrc
# delete & undelete commands
function garbageinit () {
if [ ! -d $HOME/.wastebasket ]; then
echo "Create $HOME/.wastebasket"
[ -e $HOME/.wastebasket ] || $(which rm) -f $HOME/.wastebasket
mkdir $HOME/.wastebasket
fi
}
function rm () {
rm=$(which rm)
mv=$(which mv)
if [ $# -eq 0 ]; then
echo "rm/undelete functions"
echo "Usage: rm <file1> ..."
return 1
fi
while [ $# -gt 0 ]; do
if [ -e "$1" ] || [ -L "$1" ]; then
bn=$HOME/.wastebasket/$(basename "$1")
[ -e "$bn" ] || [ -L "$1" ]&& \
$rm -rf "$HOME/.wastebasket/$bn"
$mv -f "$1" $HOME/.wastebasket/
else
echo "rm: No such file or directory '$1'"
fi
shift
done
}
function undelete () {
mv=$(which mv)
if [ $# -eq 0 ]; then
echo "rm/undelete functions"
echo "Usage: undelete <file1> ..."
return 1
fi
while [ $# -gt 0 ]; do
n="$HOME/.wastebasket/$1"
if [ -e "$n" ] || [ -L "$n" ]; then
bn=$(basename "$1")
if [ -e "./$bn" ] || [ -L "./$bn" ]; then
$mv -f "./$bn" "$n.undelete"
$mv -f "$n" "./$bn"
$mv -f "$n.undelete" "$n"
else
$mv -f "$n" "./$bn"
fi
else
echo "undelete: No such file or directory '$1'"
fi
shift
done
}
function garbageclean () {
$(which rm) -rf $HOME/.wastebasket
garbageinit >&/dev/null
}
function garbagelist () {
ls=$(which ls)
nf=$($ls -1A $HOME/.wastebasket/ | wc -w)
echo "List of file(s) in garbage: $nf file(s) "
$ls -CFA $HOME/.wastebasket | sed -e /total/d
gf=$(du -s $HOME/.wastebasket | awk '{ print $1 }' )
echo "Garbage filled: $((gf - 1)) Ko"
}
# startup commands
garbageinit
# todo commands
TODO_OPTS="--summary"
if [ -e "$(which devtodo)" ]; then
function cd () {
builtin cd "$@" && [ -f .todo ] && devtodo ${TODO_OPTS}
}
function pushd () {
builtin pushd "$@" && [ -f .todo ] && devtodo ${TODO_OPTS}
}
function popd () {
builtin popd && [ -f .todo ] && devtodo ${TODO_OPTS}
}
fi
# run todo initially upon login
[ -e "$(which devtodo)" ] && devtodo ${TODO_OPTS}