2009/2/3 Guilherme Gall <gmg...@gmail.com>: > 2009/2/3 voyeg3r <voye...@yahoo.com.br>: > > #!/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