Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jul 2020 22:09:28 +0200
From:      Polytropon <freebsd@edvax.de>
To:        "@lbutlr" <kremels@kreme.com>
Cc:        FreeBSD <freebsd-questions@freebsd.org>
Subject:   Re: tbz file from pkg
Message-ID:  <20200726220928.290a8ef4.freebsd@edvax.de>
In-Reply-To: <464D3ED6-6A05-495C-BC21-2C5C3277F2A1@kreme.com>
References:  <CAPmsJLC0yTtek8AKo6r_XL8yt_9dCNvGs1jyVyOTu6g9N7YziA@mail.gmail.com> <20200725203801.9a4965b8.freebsd@edvax.de> <CAPmsJLAdK-1aS8r6=oB253ooZyaL2Q6GMNG-sAJBdR_KEXoGRg@mail.gmail.com> <CAPmsJLAYACVmXF%2BpzeBosP8AT8n8ewY7%2BDGtHeSezB_8EP2zBg@mail.gmail.com> <C738FB9C-EAD2-484A-9D72-2240EA487E4B@kreme.com> <7ED1C2F2-B3E7-463B-95DB-C58CF6008CA3@kreme.com> <464D3ED6-6A05-495C-BC21-2C5C3277F2A1@kreme.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 26 Jul 2020 06:33:35 -0600, @lbutlr wrote:
> On 26 Jul 2020, at 06:32, @lbutlr <kremels@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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200726220928.290a8ef4.freebsd>