So I have this script which im trying to determine the type of the file and act accordingly, I am determining the type of the file using file command and then grep for specific string , for example if the file is zipped then unzip it, if its gzipped then gunzip it, I want to add a lot of different types of file.
I am trying to replace the if statements with case and can't figure it out
My script looks like this:
##$arg is the file itself 
TYPE="$(file $arg)"
if [[ $(echo $TYPE|grep "bzip2") ]] ; then
 bunzip2 $arg
elif [[ $(echo $TYPE|grep "Zip") ]] ; then
  unzip $arg
fi
Thanks to everyone that help :)
 
     
    