<corta>

#!/bin/sh

DIR=$1

cd $DIR

for i in *; do

        case $i in
        *.tar.gz)
                tar -zxf $i
                ;;
        *.tar.bz2)
                tar -jxf $i
                ;;
        *.zip)
                unzip -x $i
                ;;
        *.rar)
                unrar -x $i
                ;;
        *.tgz)
                tar -zxf $i
                ;;
        *.tbz2)
                tar -jxf $i
                ;;
        *.tbz)
                tar -jxf $i
                ;;
        *.gz)
                gunzip $i
                ;;
        *.bz2)
                bunzip2 $i
                ;;
        esac
done    
cd $OLDPWD

#### FIM DO SCRIPT

uso:
$ descompacta diretorio

Verifique a sintaxe dos comandos unzip e unrar, e TESTE este script
antes de usá-lo em trabalho sério.

-- 
Emacs is a great operating system---it lacks a good editor, though.

Responder a