dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE

unpack (527B)


      1 #!/usr/bin/env sh
      2 
      3 # Description: Unpack files in selection
      4 #
      5 # Shell: generic
      6 
      7 files="$(xargs -0 < ~/.nnncp)"
      8 for f in $files; do
      9     extension=$(echo "${f##*.}" | awk '{print tolower($0)')
     10     #mimetype=$(file --mime-type -Lb "$f")
     11     case "$extension" in
     12         tar.gz)
     13             tar xvfz "$f"
     14             ;;
     15         tar.bz2)
     16             tar xvfj "$f"
     17             ;;
     18         zip)
     19             unzip "$f"
     20             ;;
     21         *) 
     22             echo "Unknown file type '$extension' of file $f"
     23             ;;
     24     esac
     25 done