Skip to content

Instantly share code, notes, and snippets.

@mattak
Created August 18, 2011 11:38
Show Gist options
  • Save mattak/1153904 to your computer and use it in GitHub Desktop.
Save mattak/1153904 to your computer and use it in GitHub Desktop.
unfreeze file on linux
#!/bin/sh
usage ()
{
echo "usage: unfreeze <some freezed file>"
echo "supported file:"
echo " .tar.bz2"
echo " .tbz2"
echo " .tbz"
echo " .tgz"
echo " .zip"
echo " .tar"
exit 1
}
if [ $# -ne 1 ]; then
usage
fi
if [ `echo $1 | grep -E ".tar.bz2$"` ]; then
echo "tar.bz2"
tar -jxf $1
elif [ `echo $1 | grep -E ".tbz2$"` ]; then
echo "tbz2"
tar -jxf $1
elif [ `echo $1 | grep -E ".tbz$"` ]; then
echo "tbz"
tar zxvf $1
elif [ `echo $1 | grep -E ".tgz$"` ]; then
echo "tgz"
tar zxvf $1
elif [ `echo $1 | grep -E ".zip$"` ]; then
echo "zip"
unzip $1
elif [ `echo $1 | grep -E ".tar$"` ]; then
echo "tar"
tar xvf $1
else
echo "unsupported file format: $1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment