Você poderia usar algo assim.
if [ installation = "1" ]; then
for package in *.tar.*
do
tar -xvf ${package} # Unpack (Let tar detect compression type)
done
./configure
elif [ installation = "2" ]; then
dpkg -i ${deb_package} #it has to install the deb package
fi
Não há necessidade de detectar manualmente o tipo de compactação por meio de ls
/ grep
hacks.
The only case when you have to specify a decompression option while
reading the archive is when reading from a pipe or from a tape drive
that does not support random access. However, in this case GNU tar
will indicate which option you should use. For example:
$ cat archive.tar.gz | tar tf -
tar: Archive is compressed. Use -z option
tar: Error is not recoverable: exiting now
If you see such diagnostics, just add the suggested option to the
invocation of GNU tar:
$ cat archive.tar.gz | tar tzf -
- 8.1.1 Criando e lendo arquivos compactados