1# Some useful aliases. 2alias texclean='rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky' 3alias clean='echo -n "Really clean this directory?"; 4 read yorn; 5 if test "$yorn" = "y"; then 6 rm -f \#* *~ .*~ *.bak .*.bak *.tmp .*.tmp core a.out; 7 echo "Cleaned."; 8 else 9 echo "Not cleaned."; 10 fi' 11alias h='history' 12alias j="jobs -l" 13alias l="ls -l " 14alias ll="ls -l" 15alias ls="ls -F" 16alias pu="pushd" 17alias po="popd" 18 19# 20# Csh compatability: 21# 22alias unsetenv=unset 23function setenv () { 24 export $1="$2" 25} 26 27# Function which adds an alias to the current shell and to 28# the ~/.bash_aliases file. 29add-alias () 30{ 31 local name=$1 value="$2" 32 echo alias $name=\'$value\' >>~/.bash_aliases 33 eval alias $name=\'$value\' 34 alias $name 35} 36 37# "repeat" command. Like: 38# 39# repeat 10 echo foo 40repeat () 41{ 42 local count="$1" i; 43 shift; 44 for i in $(seq 1 "$count"); 45 do 46 eval "$@"; 47 done 48} 49 50# Subfunction needed by `repeat'. 51seq () 52{ 53 local lower upper output; 54 lower=$1 upper=$2; 55 56 if [ $lower -ge $upper ]; then return; fi 57 while [ $lower -le $upper ]; 58 do 59 echo -n "$lower " 60 lower=$(($lower + 1)) 61 done 62 echo "$lower" 63} 64