]> git.llucax.com Git - personal/documentos.git/blob - bin/desempaquetar
Más titulares de crónica.
[personal/documentos.git] / bin / desempaquetar
1 #!/bin/sh
2 if [ "`echo "$1" | grep .zip`" ]; then
3     comando="unzip"
4 else
5     if [ "`echo "$1" | grep .rar`" ]; then
6         comando="unrar x -p-"
7     else
8         if [ "`echo "$1" | grep .ace`" ]; then
9             comando="unace x -c-"
10         else
11             if [ "`echo "$1" | grep .tar.bz2`" ]; then
12                comando="tar -xvjf"
13             else
14                 if [ "`echo "$1" | grep .tar.gz`" ]; then
15                    comando="tar -xvjf"
16                 else
17                     comando="tar -xvf"
18                 fi
19             fi
20         fi
21     fi
22 fi
23 dir=`dirname "$1"`
24 filename=`basename "$1"`
25 cd "$dir"
26 $comando "$filename"
27 cd "$OLDPWD"