I haven't put much effort into figuring out what you're trying to do but, assuming that awstats.pl accepts stuff via stdin, you probably want to do something like this: gunzip <$n | /path/to/my/cgi-bin/awstats.pl -config=www.buzgate.org -update -logfile=stdin