diff options
author | Florian Pritz <f-p@gmx.at> | 2009-01-12 19:45:48 +0100 |
---|---|---|
committer | Florian Pritz <f-p@gmx.at> | 2009-01-12 19:45:48 +0100 |
commit | 323816ffd1e4d78ba5ac596de5f6c36b48c31434 (patch) | |
tree | 222f32f6f394aa04ab7ed6a34539cd425b4f67d7 /extract.sh | |
parent | 2c6e3fddb3d0a3a95afd395c16f119def05e2a28 (diff) | |
download | bin-323816ffd1e4d78ba5ac596de5f6c36b48c31434.tar.gz bin-323816ffd1e4d78ba5ac596de5f6c36b48c31434.tar.xz |
forgot to commit for some time... :(
Diffstat (limited to 'extract.sh')
-rwxr-xr-x | extract.sh | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/extract.sh b/extract.sh deleted file mode 100755 index bbb317a..0000000 --- a/extract.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -#----------------------------------------------------# -# File: ~/bin/extract.sh # -# Version: 0.1.0 # -# Date: 2008-11-02 # -# Author: Florian "Bluewind" Pritz <f-p@gmx.at> # -# Extract an archive based on the mime type # -#----------------------------------------------------# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -if [ "$1" = "" ] || [ "$1" = "-h" ]; then - echo -e "${blue}Usage:$NC $0 <file>"; - echo -e "Extracts <file>"; - echo -e "Also accepts multiple files"; - exit 0 -fi -for file in "$@" -do - if [ -f ${file} ] ; then - case ${file} in - *.tar.bz2) tar xjf ${file} ;; - *.tar.gz) tar xzf ${file} ;; - *.tbz2) tar xjf ${file} ;; - *.tgz) tar xzf ${file} ;; - *) - case $(file -bi ${file}) in - application/x-bzip2) bunzip2 ${file};; - application/rar) unrar x ${file};; - application/x-gzip) gunzip ${file};; - application/x-tar) tar xf ${file};; - application/zip) unzip ${file};; - application/x-compressed) uncompress ${file};; - application/x-7z-compressed) 7z x ${file};; - *) echo -e "${RED}Error:$NC No rule how to extract \"${file}\" ($(file -bi ${file}))" ;; - esac - ;; - esac - else - echo -e "${RED}Error:$NC \"${file}\" doesn't exist" - fi -done |