The following creates csfile
with a hash in it, unpacks go1.17.4.linux-amd64.tar.gz
downloaded from Golang's official website,
prints out the checksum to stdout and then removes the no longer needed csfile
:
wget -qO- https://go.dev/dl/go1.17.4.linux-amd64.tar.gz|tee >(sha256sum>csfile) |tar -xz && cat csfile && rm csfile
I would like to get the checksum on my screen and the archive unpacked without creating a file like csfile
. Is it doable?
Based on some research that I did I've tried the following two one-liners (to no avail - although the archive gets unpacked, binary output is spitted out to the screen):
wget -qO- https://go.dev/dl/go1.17.4.linux-amd64.tar.gz|tee >(sha256sum) >(sudo tar -xz>/dev/null)
wget -qO- https://go.dev/dl/go1.17.4.linux-amd64.tar.gz|tee >(sudo tar -xz>/dev/null) >(sha256sum)
On the other hand, neither of the following two one-liners does upack the archive, but both of them do produce the checksum after spitting out the binary output:
wget -qO- https://go.dev/dl/go1.17.4.linux-amd64.tar.gz|tee >(xargs tar -xz) >(sha256sum)
wget -qO- https://go.dev/dl/go1.17.4.linux-amd64.tar.gz|tee >(sudo xargs tar -xz>/dev/null) >(sha256sum)
Why is the binary output spitted out on the screen? Is it spitted by tar
or by sha256sum
? I would rather avoid using sudo
if doable. How might I direct the output of wget
to both tar
and sha256sum
?