scripts

misc scripts and tools
git clone git://git.2f30.org/scripts
Log | Files | Refs

unpk (768B)


      1 #!/bin/sh
      2 
      3 # extract archives
      4 # depends: unzip unace unrar 7z
      5 
      6 if test -z "$1"; then
      7     echo "usage: $(basename $0) archive ..." && exit 1
      8 fi
      9 
     10 while test -n "$1"; do
     11     case "$1" in
     12     *.tar.gz | *.tgz)
     13     tar xzf "$1"
     14     shift
     15     ;;
     16     *.tar.bz2 | *.tbz)
     17     tar xjf "$1"
     18     shift
     19     ;;
     20     *.zip)
     21     unzip "$1"
     22     shift
     23     ;;
     24     *.jar)
     25     unzip "$1"
     26     shift
     27     ;;
     28     *.war)
     29     unzip "$1"
     30     shift
     31     ;;
     32     *.ace)
     33     unace x "$1"
     34     shift
     35     ;;
     36     *.rar)
     37     unrar x "$1"
     38     shift
     39     ;;
     40     *.7z)
     41     7z x "$1"
     42     shift
     43     ;;
     44     *.tar)
     45     tar xf "$1"
     46     shift
     47     ;;
     48     *.gz)
     49     gunzip "$1"
     50     shift
     51     ;;
     52     *.bz2)
     53     bunzip2 "$1"
     54     shift
     55     ;;
     56     *)
     57     echo "file format not supported: $1"
     58     shift
     59     ;;
     60     esac
     61 done