zsh-users
 help / color / mirror / code / Atom feed
* tar bzip
@ 2003-02-23  1:41 Dennis Haney
  2003-02-23  1:52 ` William Park
  2003-02-23  1:55 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Dennis Haney @ 2003-02-23  1:41 UTC (permalink / raw)
  To: zsh-users


xvzf is in my fingers and I keep forgetting it every time I untar a
bzip file, so:

How is it possible to get tar xvzf something.tbz (or
something.tar.bz2) to convert the z (in xvzf) to a j?

-- 
Dennis
use Inline C => qq{void p(char*g){
printf("Just Another %s Hacker\n",g);}};p("Perl");


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tar bzip
  2003-02-23  1:41 tar bzip Dennis Haney
@ 2003-02-23  1:52 ` William Park
  2003-02-23  1:55 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: William Park @ 2003-02-23  1:52 UTC (permalink / raw)
  To: zsh-users

On Sun, Feb 23, 2003 at 02:41:58AM +0100, Dennis Haney wrote:
> 
> xvzf is in my fingers and I keep forgetting it every time I untar a
> bzip file, so:
> 
> How is it possible to get tar xvzf something.tbz (or
> something.tar.bz2) to convert the z (in xvzf) to a j?

Perhaps, 
    case $2 in
	*.tbz|*.tar.bz2) tar ${1/z/j} $2
    esac

-- 
William Park, Open Geometry Consulting, <opengeometry@yahoo.ca>
Linux solution for data management and processing. 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tar bzip
  2003-02-23  1:41 tar bzip Dennis Haney
  2003-02-23  1:52 ` William Park
@ 2003-02-23  1:55 ` Bart Schaefer
  2003-02-23 14:42   ` Dennis Haney
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2003-02-23  1:55 UTC (permalink / raw)
  To: Dennis Haney, zsh-users

On Feb 23,  2:41am, Dennis Haney wrote:
} 
} xvzf is in my fingers and I keep forgetting it every time I untar a
} bzip file, so:
} 
} How is it possible to get tar xvzf something.tbz (or
} something.tar.bz2) to convert the z (in xvzf) to a j?

Possibly this:

    function tar {
      integer i=1
      while (( i < ARGC ))
      do
	if [[ $argv[i] == (x*v|v*x)*f && $argv[i] == *z* &&
	      $argv[i+1] == *.(t|)bz(|2) ]]
	   argv[i]=${argv[i]:s/z/j}
	   break
	fi
      done
      command tar $*
    }

The problem of course is that something like xvzbf is followed first by
a blocksize and then by a file name, so without creating a full-blown
tar option parser you really can't do a perfect job.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: tar bzip
  2003-02-23  1:55 ` Bart Schaefer
@ 2003-02-23 14:42   ` Dennis Haney
  0 siblings, 0 replies; 4+ messages in thread
From: Dennis Haney @ 2003-02-23 14:42 UTC (permalink / raw)
  To: zsh-users


>>>>> "Bart" == Bart Schaefer <schaefer@brasslantern.com> 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");


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-23 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-23  1:41 tar bzip Dennis Haney
2003-02-23  1:52 ` William Park
2003-02-23  1:55 ` Bart Schaefer
2003-02-23 14:42   ` Dennis Haney

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).