Page 1 of 1

[SCRIPT] Unpack compressed files

Posted: 29 Dec 2010, 06:34
by brokenman
Do you keep forgetting the different switches for unpacking tarballs?

Paste this into a text file, save it as /usr/bin/unpack
Make it executable: chmod +x /usr/bin/unpack
Now to unpack most compressed files just use: unpack myfile.tar.bz2

Code: Select all


FEXT=$(echo $1 | grep -o '\.[^.]*$')
case "$FEXT" in
tar -jxvf $INPUT;
tar -zxvf $INPUT
tar -xvf $INPUT;
unzip $INPUT;