| Updated on | |
Bash example shell script for decompressing compressed filesSupported compression formats are tar, gzip, bzip2, and zip.
#!/bin/sh
# Bash multi compression format expander 1.0
# Author: Douglas Palovick
# License: GPL http://www.gnu.org/licenses/gpl.txt
for FILE in "$@" ; do
FILE2=$FILE; #Just for safe keeping
if [[ $FILE = *.tar.gz || $FILE = *.tgz ]];
then
echo "untarring and ungzipping $FILE2"; `echo /bin/tar -zxvf $FILE2`;
elif [[ $FILE = *.zip ]];
then
echo "unzipping $FILE2"; `echo /usr/bin/unzip $FILE2`;
elif [[ $FILE = *.tar.bz2 ]];
then
echo "untar and unbzipping $FILE2"; `echo /bin/tar -jxvf $FILE2`;
else
echo "no $FILE2";
fi
done
|