From 834f0ce07b8224c9cee6985f0256d0a3fd6e5ae9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 21 Oct 2009 11:57:53 +0200 Subject: functions: extr → extract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- etc/aliases/suffix | 2 +- etc/functions/extr | 32 -------------------------------- etc/functions/extract | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 etc/functions/extr create mode 100644 etc/functions/extract (limited to 'etc') diff --git a/etc/aliases/suffix b/etc/aliases/suffix index 0c65430..2587c3e 100644 --- a/etc/aliases/suffix +++ b/etc/aliases/suffix @@ -4,7 +4,7 @@ typeset -A alias_apps alias_apps=( - archive extr + archive extract audio mplayer document kpdf image feh diff --git a/etc/functions/extr b/etc/functions/extr deleted file mode 100644 index ac98916..0000000 --- a/etc/functions/extr +++ /dev/null @@ -1,32 +0,0 @@ -## vim:ft=zsh -## Extract archives -## Usage: extr - -function confirm_shar { - echo -ne "\e[1;33mshar archives are shell scripts and can easily contain malicious code.\e[0m Proceed? [y/N] " - read -q -} - -if [[ -f $1 ]] { - case $1 in - *.(tar.bz2|bz2)) tar xvjf $1 ;; - *.(tar.gz|tgz)) tar xvzf $1 ;; - *.tar.lzma) unlzma $1 | tar xv ;; - *.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 ;; - *.zip) unzip $1 ;; - *.Z) uncompress $1 ;; - *.shar) confirm_shar && sh $1 ;; - *.cpio) cpio --no-absolute-filenames -idv < $1 ;; - *.lzma) unlzma $1 ;; - *) echo "Unknown archive type: $1"; return 2 ;; - esac -} else { - echo "No such file: $1" - return 1 -} diff --git a/etc/functions/extract b/etc/functions/extract new file mode 100644 index 0000000..ac98916 --- /dev/null +++ b/etc/functions/extract @@ -0,0 +1,32 @@ +## vim:ft=zsh +## Extract archives +## Usage: extr + +function confirm_shar { + echo -ne "\e[1;33mshar archives are shell scripts and can easily contain malicious code.\e[0m Proceed? [y/N] " + read -q +} + +if [[ -f $1 ]] { + case $1 in + *.(tar.bz2|bz2)) tar xvjf $1 ;; + *.(tar.gz|tgz)) tar xvzf $1 ;; + *.tar.lzma) unlzma $1 | tar xv ;; + *.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 ;; + *.zip) unzip $1 ;; + *.Z) uncompress $1 ;; + *.shar) confirm_shar && sh $1 ;; + *.cpio) cpio --no-absolute-filenames -idv < $1 ;; + *.lzma) unlzma $1 ;; + *) echo "Unknown archive type: $1"; return 2 ;; + esac +} else { + echo "No such file: $1" + return 1 +} -- cgit v1.2.3