2009/2/3 Guilherme Gall <[email protected]>:
> 2009/2/3 voyeg3r <[email protected]>:
>
> #!/bin/bash
>
> extract(){
> for file in "$@"; do
> if [ -f "$file" ]; then
> case "$file" in
> *.tar.bz2) tar xvjf "$file";;
> *.tar.gz) tar xvzf "$file";;
> *.bz2) bunzip2 "$file";;
> *.rar) rar x "$file";;
> *.gz) gunzip "$file";;
> *.tar) tar xvf "$file";;
> *.tbz2) tar xvjf "$file";;
> *.tgz) tar xvzf "$file";;
> *.zip) unzip "$file";;
> *.Z) uncompress "$file";;
> *.7z) 7z x "$file";;
> *) echo "não sei como extrair '$file'...";;
> esac
> else
> echo "'$file' não é um arquivo válido"
> fi
> done
> }
>
> # Fim do script
Fora que da pra unir essas opções:
*.tar.bz2|*.tbz2) tar xvjf "$file";;
*.tar.gz|*.tgz) tar xvzf "$file";;
*.bz2) bunzip2 "$file";;
*.rar) rar x "$file";;
*.gz) gunzip "$file";;
*.tar) tar xvf "$file";;
*.zip) unzip "$file";;
*.Z) uncompress "$file";;
*.7z) 7z x "$file";;
*) echo "não sei como extrair '$file'...";;
--
Reinaldo de Carvalho
http://korreio.sf.net (Now available in English)
http://python-cyrus.sf.net