Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: tar bzip

>>>>> "Bart" == Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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) ]]
    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.

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

Messages sorted by: Reverse Date, Date, Thread, Author