Added extract.sh (Not working yet)
This commit is contained in:
parent
a0398e3a15
commit
1c34791149
1 changed files with 31 additions and 0 deletions
31
scripts/extract.sh
Executable file
31
scripts/extract.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/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
|
Loading…
Reference in a new issue