Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. function extract() {
  2. filename=$1
  3. if [ -f $filename ]; then
  4. case $filename in
  5. *.tar.xz) tar xvfJ $filename ;;
  6. *.tar.gz) tar --gzip -xvf $filename ;;
  7. *.tar.bz2) tar --bzip2 -xvf $filename ;;
  8. *.tar) tar -xvf $filename ;;
  9. *.tgz) tar --gzip -xvf $filename ;;
  10. *.tbz2) tar --bzip2 -xvf $filename ;;
  11. *.bz2) bunzip2 $filename ;;
  12. *.7z) 7za x $filename ;;
  13. *.Z) uncompress --keep $filename ;;
  14. *.zip) unzip $filename -d ${filename%.*} ;;
  15. *.rar) unrar x $filename ;;
  16. *.jar) jar xf $filename ;;
  17. *) echo "'$filename' not supported extension" ;;
  18. esac
  19. else
  20. echo "'$filename' not a file."
  21. fi
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement