012ad5ca6daa71d8b519fca1ddf7cf8750529381
[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 term='set noglob; eval `tset -Q -s `'
17 alias pu="pushd"
18 alias po="popd"
19
20 #
21 # Csh compatability:
22 #
23 alias unsetenv=unset
24 function setenv () {
25   export $1="$2"
26 }
27
28 # Function which adds an alias to the current shell and to
29 # the ~/.bash_aliases file.
30 add-alias ()
31 {
32    local name=$1 value="$2"
33    echo alias $name=\'$value\' >>~/.bash_aliases
34    eval alias $name=\'$value\'
35    alias $name
36 }
37
38 # "repeat" command.  Like:
39 #
40 #       repeat 10 echo foo
41 repeat ()
42
43     local count="$1" i;
44     shift;
45     for i in $(seq 1 "$count");
46     do
47         eval "$@";
48     done
49 }
50
51 # Subfunction needed by `repeat'.
52 seq ()
53
54     local lower upper output;
55     lower=$1 upper=$2;
56     while [ $lower -le $upper ];
57     do
58         output="$output $lower";
59         lower=$[ $lower + 1 ];
60     done;
61     echo $output
62 }
63