Advertisement
Rnery

Extracting files...

Dec 22nd, 2021 (edited)
288
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.43 KB | Source Code | 1 0
  1. #!/usr/bin/env bash
  2.  
  3. function extrair () {
  4.     if [ -f $1 ]; then
  5.         case $1 in
  6.             *.tar.bz2)  tar xjf $1;;
  7.             *.tar.gz)   tar xzf $1;;
  8.             *.bz2)  bunzip2 $1;;
  9.             *.rar)  rar x $1;;
  10.             *.gz)   gunzip $1;;
  11.             *.tar)  tar xf $1;;
  12.             *.tbz2) tar xjf $1;;
  13.             *.tgz)  tar xzf $1;;
  14.             *.zip)  unzip $1;;
  15.             *.Z)    uncompress $1;;
  16.             *)  echo "'$1' Não pode ser extraído!" ;;
  17.         esac
  18.     else
  19.         echo "'$1' Não é um arquivo válido!"
  20.     fi
  21. }
  22.  
Tags: Linux BASH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement