diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:38:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:38:56 +0000 |
commit | 6c20c8ed2cb9ab69a1a57ccb2b9b79969a808321 (patch) | |
tree | f63ce19d57fad3ac4a15bc26dbfbfa2b834111b5 /examples/startup-files/Bash_aliases | |
parent | Initial commit. (diff) | |
download | bash-6c20c8ed2cb9ab69a1a57ccb2b9b79969a808321.tar.xz bash-6c20c8ed2cb9ab69a1a57ccb2b9b79969a808321.zip |
Adding upstream version 5.2.15.upstream/5.2.15upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | examples/startup-files/Bash_aliases | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/examples/startup-files/Bash_aliases b/examples/startup-files/Bash_aliases new file mode 100644 index 0000000..2abb93e --- /dev/null +++ b/examples/startup-files/Bash_aliases @@ -0,0 +1,63 @@ +# Some useful aliases. +alias texclean='rm -f *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky' +alias clean='echo -n "Really clean this directory?"; + read yorn; + if test "$yorn" = "y"; then + rm -f \#* *~ .*~ *.bak .*.bak *.tmp .*.tmp core a.out; + echo "Cleaned."; + else + echo "Not cleaned."; + fi' +alias h='history' +alias j="jobs -l" +alias l="ls -l " +alias ll="ls -l" +alias ls="ls -F" +alias pu="pushd" +alias po="popd" + +# +# Csh compatibility: +# +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" +} |