Ou então: #!/bin/bash extract(){ for file in "$@" do if [ -f "$file" ] then case "$file" in *.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'...";; esac || echo Arquivo $file corrompido else echo "'$file' não é um arquivo válido" fi done } -- Abração, *Julio Cursos de Shell e Zenity nos finais de semana: - Em SP ligue (11) 2125-4747; - Em DF ligue (61) 3223-3000; - No RJ brevemente; - Turmas fechadas em outras cidades ligue (21) 8112-9988*
2009/2/3 Reinaldo de Carvalho <reinal...@gmail.com> > 2009/2/3 Guilherme Gall <gmg...@gmail.com <gmgall%40gmail.com>>: > > > 2009/2/3 voyeg3r <voye...@yahoo.com.br <voyeg3r%40yahoo.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 > > [As partes desta mensagem que não continham texto foram removidas]