-
-
Save angelbladex/4999350 to your computer and use it in GitHub Desktop.
Un simple script en Bash para facilitar extraer contenido de algunos comprimidos -- An simple script on Bash for extract content from some compressed file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
##This can be on /bin/ or /usr/bin or any site of your $PATH | |
####Based on https://gist.github.com/guerrerocarlos/3977495 | |
if [[ ! -n "$1" ]];then | |
echo "Archivo no ingresado" | |
exit | |
fi | |
if [ -f "$1" ] ; then | |
case "$1" in | |
*.tar.bz2) tar xvjf "$1" ;; | |
*.arj) arj e "$1" ;; | |
*.jar) jar xf "$1" ;; | |
*.tar.gz) tar xvzf "$1" ;; | |
*.bz2) bunzip2 "$1" ;; | |
*.rar) unrar x "$1" ;; | |
*.gz) gunzip "$1" ;; | |
*.tar) tar xvf "$1" ;; | |
*.tbz2) tar xvjf "$1" ;; | |
*.tgz) tar xvzf "$1" ;; | |
*.zip) unzip "$1" ;; | |
*.Z) uncompress "$1" ;; | |
*.7z) 7z x "$1" ;; | |
*.xz) unxz "$1" ;; | |
*) echo "Aun no se como extraer '$1'..." ;; | |
esac | |
else | |
echo "¡ '$1' no es un archivo válido!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use too dtrx http://www.tecmint.com/dtrx-an-intelligent-archive-extraction-tar-zip-cpio-rpm-deb-rar-tool-for-linux/