dotfiles

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

commit a99eb9a756452a204ae465c60ac250f559719e1a
parent a6095e7e5967b94d695fbd922d34e42cd98396c9
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Sat,  9 Mar 2019 21:27:15 +0100

Add unpack script

Diffstat:
Alinks/.config/nnn/unpack.sh | 25+++++++++++++++++++++++++
1 file changed, 25 insertions(+), 0 deletions(-)

diff --git a/links/.config/nnn/unpack.sh b/links/.config/nnn/unpack.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env sh + +# Description: Unpack files in selection +# +# Shell: generic + +files="$(xargs -0 < ~/.nnncp)" +for f in $files; do + extension=$(echo "${f##*.}" | awk '{print tolower($0)') + #mimetype=$(file --mime-type -Lb "$f") + case "$extension" in + tar.gz) + tar xvfz "$f" + ;; + tar.bz2) + tar xvfj "$f" + ;; + zip) + unzip "$f" + ;; + *) + echo "Unknown file type '$extension' of file $f" + ;; + esac +done