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

Re: tar bzip



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.



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