blob: d4835f6bb149ab10ffff40876797d240272b767d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#! /usr/bin/env dash
# shellcheck source=/dev/null
SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
# shellcheck disable=SC2269
f="$f"
# shellcheck disable=SC2269
fx="$fx"
# shellcheck disable=SC2269
fs="$fs"
# shellcheck disable=SC2269
id="$id"
# extract the current file with the right command
# (xkcd link: https://xkcd.com/1168/)
set -f
unarchive() {
case "$1" in
*.tar.bz | *.tar.bz2 | *.tbz | *.tbz2) tar xjvf "$1" ;;
*.tar.gz | *.tgz) tar xzvf "$1" ;;
*.tar.xz | *.txz) tar xJvf "$1" ;;
*.zip) unzip "$1" ;;
*.rar)
die "rar is a unfree format!"
;;
*.7z) 7z x "$1" ;;
*) die "Unsupported format" ;;
esac
}
while read -r file; do
unarchive "$file"
done <"$fx"
# vim: ft=sh
|