#!/bin/bash 
# This file was installed by the package user-de and contains some
# useful bash aliases and settings, not only for German speaking users!
# It is derived from Bash_aliases in bash examples, but has been strongly
# modified by Dr. Guenter Bechly, 4th February 2001

#
# SVGAlib/SVGATextmode settings (do not just use these settings,
# but adjust them to your system!!!)
#
#export SVGALIB_DEFAULT_MODE=G1280x1024x256

#
# Default editor (adjust to your preferences, e.g. /usr/bin/mcedit)
#
#export EDITOR=/usr/bin/vim
#export VISUAL=$EDITOR

#
# Terminal text colour, e.g. yellow text on black background (looks very good)
#
#setterm -background black -foreground yellow -store

#
# Settings for less
#
export LESSCHARSET=latin1
export LESS=-MM

#
# aliases for the more novice (and DOS aware) people
#
alias cp='cp -i'
alias mv='mv -i'
#alias rm='rm -i -R' is dangerous if you erroneously rely on it on other computers
#alias rmdir='rmdir -p' can be dangerous as well
alias ren='mv -i'
alias deldir='rmdir -p'
alias cls='clear'
alias md='mkdir'
alias rd='rmdir -p'
alias mem='free'
#alias dir='ls -C -F --color' not nessary, because there is an executable /bin/dir
alias copy='cp -i'
alias move='mv -i'
alias del='rm -i -R'
alias remove='rm -i -R'
alias delete='rm -i -R'
alias cd..='cd ..'
alias less='less -r'
alias l='ls -lF'

#
# Some useful aliases for system administrators (thus you ;-)
#
#alias webmin='w3m-ssl-en https://amber:10000/'
#alias etc-backup="\cp -a /etc/* /home/etc-backup"
#alias wm='update-alternatives --config x-window-manager'
#alias update-alternatives='update-alternatives --admindir /var/lib/dpkg/alternatives/'
#alias ntpdate="ntpdate -v ntp1.cs.wisc.edu"

#
# Some useful aliases for Debian developers
#
#alias removals='w3m http://ftp-master.debian.org/removals.txt'
#alias removals-nonus='w3m http://nonus.debian.org/~troup/removals.txt'
#alias incoming='w3m http://incoming.debian.org/'
#alias maintainers='w3m http://www.debian.gr.jp/~kitame/maint.rhtml'
#alias popularity='w3m http://www.debian.org/~apenwarr/popcon/'

#
# Further useful aliases (uncomment what you want, and adjust to your needs)
#
#alias fetchmail='fetchmail -v'
#alias pdmenu='pdmenu -c'
#alias man='pinfo -m'
#alias info='pinfo'
#alias pppstatus='pppstatus -s 56; reset'
#alias selfhtml='w3m /usr/share/doc/selfhtml/html/selfhtml.htm'
#alias debian='w3m http://www.de.debian.org/'
#alias linuxtoday='w3m http://www.linuxtoday.com/'
#alias lwn='w3m http://lwn.net/'
#alias linux.de='w3m http://www.linux.de/'
#alias gnome='w3m http://www.gnome.org/'
#alias websearch='w3m http://www.altavista.com/cgi-bin/query?text'
#alias zgv='zgv -M'
#alias gsvga='gs -sPAPERSIZE=a4 -sDEVICE=lvga256'
#alias isd='ispell -C -P -S -d ngerman -T latin1'
#alias isdh='ispell -C -P -S -d ngerman -h'
#alias isdt='ispell -P -S -d ngerman -T latin1 -t'
#alias si='si --color'
#alias format='superformat /dev/fd0 hd'
#alias mtfl='mount /floppy; cd /floppy; mc'
#alias umtfl='cd; umount /floppy'
#alias mtzip='mount /zip; cd /zip; mc'
#alias umtzip='cd; umount /zip; super eject /zip'
#alias mtcd='mount /cdrom; cd /cdrom; mc'
#alias umtcd='cd; umount /cdrom; super eject /cdrom'
#alias r='reset'
#alias c='clear'
#alias cdr='reset; cd; clear'
#alias video='plaympeg -2 --scale 320x240 -l'
#alias mutt='mutt -y'

#
# If you want to avoid suid programs, use super or sudo and aliases like
#
#alias ping='super ping'
#alias zblast='super zblast'
#alias gsvga='super gs -sPAPERSIZE=a4 -sDEVICE=lvga256'
#alias gs='super gs'
#alias ssh='super ssh'
#alias gnuplot='super gnuplot'
#alias bmv='super bmv -v13'
#alias dvisvga='super dvisvga'
#alias cdrecord='super cdrecord'
#alias plaympeg='super plaympeg'
#alias eject='super eject'
#alias shutdown='super shutdown -h now'
#alias halt='super halt'
#alias reboot='super reboot'

alias texclean='rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky'
alias clean='echo -n "Soll dieses Verzeichnis wirklich aufgerumt werden?";
	read yorn;
	if test "$yorn" = "y" -o "$yorn" = "j" ; then
	   rm -f \#* *~ .*~ *.bak .*.bak  *.tmp .*.tmp core a.out;
	   echo "Aufgerumt.";
	else
	   echo "Nicht aufgerumt.";
	fi'
alias h='history'
alias j="jobs -l"
alias ll="ls -l"
alias ls="ls -C -F -a --color"
alias l.='ls .[a-zA-Z0-9]*'
alias pu="pushd"
alias po="popd"


if [ -x /usr/bin/less ]; then
    alias l='less'
else
    alias l='more'
fi

if [ ! -z $DISPLAY ]; then
	if [ -x /usr/X11R6/xless ]; then
		alias m='xless'
	fi
fi

alias psl='ps -aux | less'
alias ..='cd ..'
alias .='echo $PWD'


#
# Csh compatability:
#
alias unsetenv=unset
function setenv () {
  export $1="$2"
}


# Function which adds an alias to the current shell and to
# the ~/.bash_aliases file.
add_alias ()
{
   local name=$1 value="$2"
   echo alias $name=\'$value\' >>~/.bash_aliases
   eval alias $name=\'$value\'
   alias $name
}


# "repeat" command.  Like:
#
#	repeat 10 echo foo
repeat ()
{ 
    local count="$1" i;
    shift;
    for i in $(seq 1 "$count");
    do
        eval "$@";
    done
}

# Subfunction needed by `repeat'.
seq ()
{ 
    local lower upper output;
    lower=$1 upper=$2;

    if [ $lower -ge $upper ]; then return; fi
    while [ $lower -le $upper ];
    do
	echo -n "$lower "
        lower=$(($lower + 1))
    done
    echo "$lower"
}
