Skip to content

Instantly share code, notes, and snippets.

@angelbladex
Forked from guerrerocarlos/.bashrc
Last active December 14, 2015 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelbladex/4999350 to your computer and use it in GitHub Desktop.
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
#! /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