Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. extract() {
  2. local c e i
  3.  
  4. (($#)) || return
  5.  
  6. for i; do
  7. c=''
  8. e=1
  9.  
  10. if [[ ! -r $i ]]; then
  11. echo "$0: file is unreadable: `$i'" >&2
  12. continue
  13. fi
  14.  
  15. case $i in
  16. *.t@(gz|lz|xz|b@(2|z?(2))|a@(z|r?(.@(Z|bz?(2)|gz|lzma|xz)))))
  17. c='bsdtar xvf';;
  18. *.7z) c='7z x';;
  19. *.Z) c='uncompress';;
  20. *.bz2) c='bunzip2';;
  21. *.exe) c='cabextract';;
  22. *.gz) c='gunzip';;
  23. *.rar) c='unrar x';;
  24. *.xz) c='unxz';;
  25. *.zip) c='unzip';;
  26. *) echo "$0: unrecognized file extension: `$i'" >&2
  27. continue;;
  28. esac
  29.  
  30. command $c "$i"
  31. e=$?
  32. done
  33.  
  34. return $e
  35. }
  36.  
  37. syntax error near unexpected token '('
  38.  
  39. *.t@(gz|lz|xz|b@(2|z?(2))|a@(z|r?(.@(Z|bz?(2)|gz|lzma|xz)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement