From 8896ac675b5bf513074d7552da7d9f4cf8d16217 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 28 Jun 2008 10:08:14 +0200 Subject: now use autoloading for functions --- etc/functions/cdl | 6 ++---- etc/functions/chpwd | 18 ++++++++---------- etc/functions/extr | 44 +++++++++++++++++++++----------------------- etc/functions/l | 20 +++++++++----------- etc/functions/plonkhost | 4 +--- etc/functions/world-readable | 4 +--- 6 files changed, 42 insertions(+), 54 deletions(-) (limited to 'etc/functions') diff --git a/etc/functions/cdl b/etc/functions/cdl index 49b4d7f..a23a0f6 100644 --- a/etc/functions/cdl +++ b/etc/functions/cdl @@ -1,4 +1,2 @@ -cdl () { - cd "$1"; - ls; -} +cd "$1"; +ls; diff --git a/etc/functions/chpwd b/etc/functions/chpwd index 8cfd926..fd8feba 100644 --- a/etc/functions/chpwd +++ b/etc/functions/chpwd @@ -1,10 +1,8 @@ -chpwd () { - pstags='' - [ -f .todo ] && pstags+='todo ' - [ -f .fehindex.jpg ] && pstags+='feh ' - [ -d .hg ] && pstags+='hg ' - [ -d .git ] && pstags+='git ' - [ -d .svn ] && pstags+='svn ' - [ -f Makefile -o -f makefile ] && pstags+='make ' - source $ZDIR/prompt -} +pstags='' +[ -f .todo ] && pstags+='todo ' +[ -f .fehindex.jpg ] && pstags+='feh ' +[ -d .hg ] && pstags+='hg ' +[ -d .git ] && pstags+='git ' +[ -d .svn ] && pstags+='svn ' +[ -f Makefile -o -f makefile ] && pstags+='make ' +source $ZDIR/prompt diff --git a/etc/functions/extr b/etc/functions/extr index 784671b..98d3ffe 100644 --- a/etc/functions/extr +++ b/etc/functions/extr @@ -1,24 +1,22 @@ # builtin function for archives, see $ZDIR/alias_suffix -extr () { - if [[ -f "$1" ]]; then - case "$1" in - *.tar.bz2) tar xjvf "$1" ;; - *.tar.gz) tar xvzf "$1" ;; - *.ace) unace e "$1" ;; - *.rar) unrar x "$1" ;; - *.deb) ar -x "$1" ;; - *.bz2) bzip2 -d "$1" ;; - *.lzh) lha x "$1" ;; - *.gz) gunzip -d "$1" ;; - *.tar) tar xvf "$1" ;; - *.tgz) gunzip -d "$1" ;; - *.tbz2) tar jxvf "$1" ;; - *.zip) unzip "$1" ;; - *.Z) uncompress "$1" ;; - *.shar) sh "$1" ;; - *) echo "I don't know the archive type of '"$1"' :(" ;; - esac - else - echo "Hm. Seems '"$1"' is not a valid file." - fi -} +if [[ -f "$1" ]]; then + case "$1" in + *.tar.bz2) tar xjvf "$1" ;; + *.tar.gz) tar xvzf "$1" ;; + *.ace) unace e "$1" ;; + *.rar) unrar x "$1" ;; + *.deb) ar -x "$1" ;; + *.bz2) bzip2 -d "$1" ;; + *.lzh) lha x "$1" ;; + *.gz) gunzip -d "$1" ;; + *.tar) tar xvf "$1" ;; + *.tgz) gunzip -d "$1" ;; + *.tbz2) tar jxvf "$1" ;; + *.zip) unzip "$1" ;; + *.Z) uncompress "$1" ;; + *.shar) sh "$1" ;; + *) echo "I don't know the archive type of '"$1"' :(" ;; + esac +else + echo "Hm. Seems '"$1"' is not a valid file." +fi diff --git a/etc/functions/l b/etc/functions/l index d461998..c95a299 100644 --- a/etc/functions/l +++ b/etc/functions/l @@ -1,12 +1,10 @@ # self-explaining, I think -l () { - if [[ -f "$1" ]]; then - case "$1" in - *.bz2) bzless "$1" ;; - *.gz) zless "$1" ;; - *) less "$1" ;; - esac - else - echo "No such file, dude." - fi -} +if [[ -f "$1" ]]; then + case "$1" in + *.bz2) bzless "$1" ;; + *.gz) zless "$1" ;; + *) less "$1" ;; + esac +else + echo "No such file, dude." +fi diff --git a/etc/functions/plonkhost b/etc/functions/plonkhost index 3b6cc95..072147a 100644 --- a/etc/functions/plonkhost +++ b/etc/functions/plonkhost @@ -1,3 +1 @@ -plonkhost () { - sudo iptables -I INPUT -s "$1" -j DROP -} +sudo iptables -I INPUT -s "$1" -j DROP diff --git a/etc/functions/world-readable b/etc/functions/world-readable index c66a479..7963223 100644 --- a/etc/functions/world-readable +++ b/etc/functions/world-readable @@ -1,3 +1 @@ -world-readable () { - chmod -R a+rX . -} +chmod -R a+rX . -- cgit v1.2.3