tbz file from pkg

Polytropon freebsd at edvax.de
Sun Jul 26 20:09:42 UTC 2020


On Sun, 26 Jul 2020 06:33:35 -0600, @lbutlr wrote:
> On 26 Jul 2020, at 06:32, @lbutlr <kremels at kreme.com> wrote:
> > 
> > for file in **/.txz; do unxr $file; bzip2< $(file%.tar}.tbz; done
> 
> Stepping away from the computer to go drink a pot of coffee.
> 
> for file in **/.txz; do unxr $file; bzip2 $(file%.tar}.tbz; done
              ^^^^^^^        ^
Huh? Too much copypasta? :-)

That would not work as expected, because **/.txz will be an
empty list, and the input file argument for bzip2 is does not
exist.

If the directory portions with $file will be handled correctly,
you decompress bla.tbz to bla.tar; if you then compress bla.tar,
bzip2 will substitute .tar for... or does it append... no, I
don't know, but I'm almost sure it will create bla.tar.bz2.
So it's probably better to be explicit than to assume something
and use "name construction" to get what you want.

Maybe something like this:

for file in */*.txz; do unxz -c $file | bzip2 $(file%.txz}.tbz; done

With this approach, you avoid creating temporary files.

NB: Constructred from memory, not from experiment.



We all should drink more coffee. The emperor will be pleased. :-)


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list