Created
August 18, 2011 11:38
-
-
Save mattak/1153904 to your computer and use it in GitHub Desktop.
unfreeze file on linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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