31 lines
589 B
Bash
Executable file
31 lines
589 B
Bash
Executable file
#!/bin/bash
|
|
|
|
extract_targz() { tar -xzvf "$1" }
|
|
extract_tarbz() { tar -xjvf "$1" }
|
|
extract_tarxz() { tar -xJvf "$1" }
|
|
extract_rar() { unrar x "$1" }
|
|
extract_zip() { unzip "$1" }
|
|
|
|
extractfile() {
|
|
case "$1" in
|
|
*.tar.gz|*.tgz)
|
|
extract_targz "$1"
|
|
;;
|
|
*.tar.bz)
|
|
extract_tarbz "$1"
|
|
;;
|
|
*.tar.xz)
|
|
extract_tarxz "$1"
|
|
;;
|
|
*.rar)
|
|
extract_rar "$1"
|
|
;;
|
|
*.zip)
|
|
extract_zip "$1"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
for file in $@; do
|
|
extractfile "$file";
|
|
done
|