I need to make a frontend for compressed files, the idea is that if you receive a gz or bz2 file, uncompress it with gunzip and bunzip2.
If what you receive is a tar.gz or a tar.b2 you should unpack and unzip it once with tar xzf or xjf. My code is the following
#!/bin/bash if test $# -ne 1 then echo "Numero de parametros incorrecto" echo "Uso del programa: $0 archivo" exit 1; fi case "$1" in *.gz) echo "gzip" echo "Descomprimiendo" `gunzip $1` ;; *.bz2) echo "bzip2" echo "Descomprimiendo" `bunzip2 $1` ;; *.tar.gz) `tar xzvf $1` ;; *.bzip2.gz) `tar xjvf $1` ;; esac
The problem is that even if I pass a file with extension .tar.gz I enter the first condition of the case, I have tried to add the dollar to be strictly that it ends like that but it does not work