Linux Compression Humanized
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
757 B

  1. #!/bin/bash
  2. function compressor()
  3. {
  4. case $1 in
  5. *.tar)
  6. tar -cvf $1 $2
  7. ;;
  8. *.tar.gz | *.tgz)
  9. tar -czvf $1 $2
  10. ;;
  11. *.tar.bz2 | *.tbz | *.tbz2 | *.tb2)
  12. tar -c $2 | bzip2 > $1
  13. ;;
  14. *.tar.xz | *.txz)
  15. tar -cJf $1 $2
  16. ;;
  17. *.bz2)
  18. bzip2 -c $2 > $1
  19. ;;
  20. *.gz)
  21. gzip -c $2 > $1
  22. ;;
  23. *.zip)
  24. zip -r $1 $2
  25. ;;
  26. *.7z)
  27. 7za a $1 $2
  28. ;;
  29. *.rar)
  30. rar a $1 $2
  31. ;;
  32. *)
  33. echo "Extension not found."
  34. echo -e "For more information run 'lch --help'\n"
  35. ;;
  36. esac
  37. echo -e "\nDone"
  38. exit 0
  39. }