[ale] Untar a bunch of .tar.gz and .tgz files

Danny Cox danscox at mindspring.com
Sat Oct 2 14:43:20 EDT 2004


On Wed, 2004-09-29 at 15:50, Mike Murphy wrote:
> The globs are irritating the shell and/or tar. One quick way to to di it 
> (assuming gnu tar and a bourne shell like shell):
> 
> dir = dir with files in them
> 
> cd $dir; for file in `ls *.tar.gz`; do tar -zxf $file; done

	1) I guess I'm in a nit-picky mood today
	2) I've been cleaning up gobs of shell scripts with the above construct
in it, so I'm also just a wee bit sensitive to it

	so pardon me please for noting:

cd $dir; for file in *.tar.gz; do tar -zxf $file; done

	Does the same thing, and saves a process.  Not usually a big deal, but
we need all the horsepower we can get (300 MHz Alpha), and saving an ls
here or there is a Good Thing (TM).

-- 
kernel, n.: A part of an operating system that preserves the
medieval traditions of sorcery and black art.

Danny



More information about the Ale mailing list