From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8580 invoked from network); 23 Feb 2003 14:42:56 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 23 Feb 2003 14:42:56 -0000 Received: (qmail 10849 invoked by alias); 23 Feb 2003 14:42:34 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5938 Received: (qmail 10842 invoked from network); 23 Feb 2003 14:42:34 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 23 Feb 2003 14:42:34 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [212.242.181.110] by sunsite.dk (MessageWall 1.0.8) with SMTP; 23 Feb 2003 14:42:33 -0000 Received: (qmail 30743 invoked from network); 23 Feb 2003 14:43:55 -0000 Received: from cine.davh.dk (HELO cine) (mail@192.168.0.110) by chacal.davh.dk with SMTP; 23 Feb 2003 14:43:55 -0000 Received: from davh by cine with local (Exim 3.35 #1 (Debian)) id 18mxKk-0000EW-00 for ; Sun, 23 Feb 2003 15:42:26 +0100 To: zsh-users@sunsite.dk Subject: Re: tar bzip References: <87lm073h95.fsf@cine.davh.dk> <1030223015556.ZM11499@candle.brasslantern.com> From: Dennis Haney Date: 23 Feb 2003 15:42:25 +0100 In-Reply-To: <1030223015556.ZM11499@candle.brasslantern.com> Message-ID: <87ptpjqcry.fsf@cine.davh.dk> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >>>>> "Bart" == Bart Schaefer writes: Bart: On Feb 23, 2:41am, Dennis Haney wrote: Bart: } Bart: } xvzf is in my fingers and I keep forgetting it every time I untar a Bart: } bzip file, so: Bart: } Bart: } How is it possible to get tar xvzf something.tbz (or Bart: } something.tar.bz2) to convert the z (in xvzf) to a j? Bart: Possibly this: Bart: function tar { Bart: integer i=1 Bart: while (( i < ARGC )) Bart: do Bart: if [[ $argv[i] == (x*v|v*x)*f && $argv[i] == *z* && Bart: $argv[i+1] == *.(t|)bz(|2) ]] Bart: argv[i]=${argv[i]:s/z/j} Bart: break Bart: fi Bart: done Bart: command tar $* Bart: } Thank you very much. This does the job just fine: function tar { if [[ $argv[1] == xvzf && $argv[2] == *.(t|tar.)bz(|2) ]] argv[1]=${argv[1]:s/z/j/} command tar $* } Bart: The problem of course is that something like xvzbf is followed first by Bart: a blocksize and then by a file name, so without creating a full-blown Bart: tar option parser you really can't do a perfect job. Thats ok, I was just interested in this one specific case. -- Dennis use Inline C => qq{void p(char*g){ printf("Just Another %s Hacker\n",g);}};p("Perl");