Re: A silly question about tar
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Cameron Hutchison wrote:
[snip]
>
> I have the following shell function defined in my .bashrc which I use to
> extract the various archives I come across. It handles multiple archives
> on the command line. Usage is simple:
>
> $ x *.tar.gz
>
> x ()
> {
> for archive in "$@"; do
> case "$archive" in
> *.tar* | *.t?z)
> case $archive in
> *.gz | *tgz | *.Z)
> TARFLAGS="--use-compress-prog gzip"
> ;;
> *.bz | *.bz2 | *tbz)
> TARFLAGS="--use-compress-prog bzip2"
> ;;
> *)
> TARFLAGS=""
> ;;
> esac;
> tar xf "$archive" ${TARFLAGS}
> ;;
> *.zip | *.ZIP)
> unzip -q "$archive"
> ;;
> *.deb)
> dpkg-deb -x "$archive" .
> ;;
> *.rar)
> unrar x "$archive"
> ;;
> *.cpio)
> cpio --extract --make-directories --file="$archive"
> ;;
> *.cpio.gz)
> gzip -dc "$archive" | cpio --extract --make-directories
> ;;
> *)
> echo "Unknown archive format" 1>&2
> ;;
> esac;
> done
> }
>
>
Another handy little script. I just love this list. It's a lot easier
to type x *.zip or x *.rar than it is to right-click on a file and say
"extract here" over and over, or selecting a bunch of files and have 20
instances of ark start all at once.
Thanks. I made one little adaptation so that it says it's doing
something. I tried it on a directory full of zip files and it
uncompressed them so quickly that I thought it didn't work. Of course
it did.
Joe
- --
Registerd Linux user #443289 at http://counter.li.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFF++52iXBCVWpc5J4RAnufAJ41dJm+nIoCte0f9TYkZiuoiOKJ9QCdEFrt
2tT7XjBxaxYsgDkNoY/JRco=
=94QT
-----END PGP SIGNATURE-----
Reply to: