Imported from ../bash-2.0.tar.gz.
[platform/upstream/bash.git] / examples / startup-files / Bash_aliases
1 # Some useful aliases.
2 alias texclean='rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky'
3 alias 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'
11 alias h='history'
12 alias j="jobs -l"
13 alias l="ls -l "
14 alias ll="ls -l"
15 alias ls="ls -F"
16 alias pu="pushd"
17 alias po="popd"
18
19 #
20 # Csh compatability:
21 #
22 alias unsetenv=unset
23 function setenv () {
24   export $1="$2"
25 }
26
27 # Function which adds an alias to the current shell and to
28 # the ~/.bash_aliases file.
29 add-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
40 repeat ()
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'.
51 seq ()
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 }